| | |
| | | var bind = require('../internals/function-bind-context'); |
| | | var uncurryThis = require('../internals/function-uncurry-this'); |
| | | var IndexedObject = require('../internals/indexed-object'); |
| | | var toObject = require('../internals/to-object'); |
| | | var lengthOfArrayLike = require('../internals/length-of-array-like'); |
| | | var arraySpeciesCreate = require('../internals/array-species-create'); |
| | | |
| | | var push = [].push; |
| | | var push = uncurryThis([].push); |
| | | |
| | | // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation |
| | | var createMethod = function (TYPE) { |
| | |
| | | return function ($this, callbackfn, that, specificCreate) { |
| | | var O = toObject($this); |
| | | var self = IndexedObject(O); |
| | | var boundFunction = bind(callbackfn, that, 3); |
| | | var boundFunction = bind(callbackfn, that); |
| | | var length = lengthOfArrayLike(self); |
| | | var index = 0; |
| | | var create = specificCreate || arraySpeciesCreate; |
| | |
| | | case 3: return true; // some |
| | | case 5: return value; // find |
| | | case 6: return index; // findIndex |
| | | case 2: push.call(target, value); // filter |
| | | case 2: push(target, value); // filter |
| | | } else switch (TYPE) { |
| | | case 4: return false; // every |
| | | case 7: push.call(target, value); // filterReject |
| | | case 7: push(target, value); // filterReject |
| | | } |
| | | } |
| | | } |