Skip to content

Commit

Permalink
fix the order of arguments validation in Array iteration methods, c…
Browse files Browse the repository at this point in the history
…lose #1313
  • Loading branch information
zloirock committed Nov 30, 2023
1 parent c44bfe9 commit b0a0055
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Moved to stable ES, [November 2023 TC39 meeting](https://twitter.com/robpalmer2/status/1729216597623976407)
- Added `es.` namespace module, `/es/` and `/stable/` namespaces entries
- Fixed `@@toStringTag` property descriptors on DOM collections, [#1312](https://github.com/zloirock/core-js/issues/1312)
- Fixed the order of arguments validation in `Array` iteration methods, [#1313](https://github.com/zloirock/core-js/issues/1313)
- Some minor `atob` / `btoa` improvements
- Compat data improvements:
- [`Promise.withResolvers`](https://github.com/tc39/proposal-promise-with-resolvers) marked as shipped from FF121
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-iteration-from-last.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ var createMethod = function (TYPE) {
return function ($this, callbackfn, that) {
var O = toObject($this);
var self = IndexedObject(O);
var boundFunction = bind(callbackfn, that);
var index = lengthOfArrayLike(self);
var boundFunction = bind(callbackfn, that);
var value, result;
while (index-- > 0) {
value = self[index];
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/internals/array-iteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var createMethod = function (TYPE) {
return function ($this, callbackfn, that, specificCreate) {
var O = toObject($this);
var self = IndexedObject(O);
var boundFunction = bind(callbackfn, that);
var length = lengthOfArrayLike(self);
var boundFunction = bind(callbackfn, that);
var index = 0;
var create = specificCreate || arraySpeciesCreate;
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
Expand Down

0 comments on commit b0a0055

Please sign in to comment.