Skip to content

Commit

Permalink
some stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 11, 2021
1 parent 128dce1 commit f2588ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core-js/internals/array-iteration-from-last.js
Expand Up @@ -5,7 +5,7 @@ var toLength = require('../internals/to-length');

// `Array.prototype.{ findLast, findLastIndex }` methods implementation
var createMethod = function (TYPE) {
var IS_FIND_INDEX = TYPE == 6;
var IS_FIND_LAST_INDEX = TYPE == 1;
return function ($this, callbackfn, that) {
var O = toObject($this);
var self = IndexedObject(O);
Expand All @@ -16,19 +16,19 @@ var createMethod = function (TYPE) {
value = self[index];
result = boundFunction(value, index, O);
if (result) switch (TYPE) {
case 5: return value; // find
case 6: return index; // findIndex
case 0: return value; // findLast
case 1: return index; // findLastIndex
}
}
return IS_FIND_INDEX ? -1 : undefined;
return IS_FIND_LAST_INDEX ? -1 : undefined;
};
};

module.exports = {
// `Array.prototype.findLast` method
// https://github.com/tc39/proposal-array-find-from-last
findLast: createMethod(5),
findLast: createMethod(0),
// `Array.prototype.findLastIndex` method
// https://github.com/tc39/proposal-array-find-from-last
findLastIndex: createMethod(6)
findLastIndex: createMethod(1)
};

0 comments on commit f2588ce

Please sign in to comment.