1 line
9.0 KiB
JSON
1 line
9.0 KiB
JSON
|
{"ast":null,"code":"var bind = require('../internals/function-bind-context');\n\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar IndexedObject = require('../internals/indexed-object');\n\nvar toObject = require('../internals/to-object');\n\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation\n\nvar createMethod = function createMethod(TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var IS_FILTER_REJECT = TYPE == 7;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that);\n var length = lengthOfArrayLike(self);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;\n var value, result;\n\n for (; length > index; index++) {\n if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3:\n return true;\n // some\n\n case 5:\n return value;\n // find\n\n case 6:\n return index;\n // findIndex\n\n case 2:\n push(target, value);\n // filter\n } else switch (TYPE) {\n case 4:\n return false;\n // every\n\n case 7:\n push(target, value);\n // filterReject\n }\n }\n }\n }\n\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.es/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.es/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.es/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.es/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.es/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.es/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.es/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6),\n // `Array.prototype.filterReject` method\n // https://github.com/tc39/proposal-array-filtering\n filterReject: createMethod(7)\n};","map":{"version":3,"names":["bind","require","uncurryThis","IndexedObject","toObject","lengthOfArrayLike","arraySpeciesCreate","push","createMethod","TYPE","IS_MAP","IS_FILTER","IS_SOME","IS_EVERY","IS_FIND_INDEX","IS_FILTER_REJECT","NO_HOLES","$this","callbackfn","that","specificCreate","O","self","boundFunction","length","index","create","target","undefined","value","result","module","exports","forEach","map","filter","some","every","find","findIndex","filterReject"],"sources":["/Users/paolasanchez/Desktop/Pry4/Katoikia/katoikia-app/web-ui/sakai-react/node_modules/core-js/internals/array-iteration.js"],"sourcesContent":["var bind = require('../internals/function-bind-context');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('.
|