0d51bee5f64fedf77b8c8f540d37578a.json 6.1 KB

1
  1. {"ast":null,"code":"'use strict';\n\nvar bind = require('../internals/function-bind-context');\n\nvar toObject = require('../internals/to-object');\n\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\n\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\n\nvar toLength = require('../internals/to-length');\n\nvar createProperty = require('../internals/create-property');\n\nvar getIteratorMethod = require('../internals/get-iterator-method'); // `Array.from` method implementation\n// https://tc39.es/ecma262/#sec-array.from\n\n\nmodule.exports = function from(arrayLike\n/* , mapfn = undefined, thisArg = undefined */\n) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case\n\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n\n for (; !(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n\n for (; length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n\n result.length = index;\n return result;\n};","map":{"version":3,"sources":["/Users/jane/Documents/Курс Front-end/HW8/myproject/node_modules/core-js-pure/internals/array-from.js"],"names":["bind","require","toObject","callWithSafeIterationClosing","isArrayIteratorMethod","toLength","createProperty","getIteratorMethod","module","exports","from","arrayLike","O","C","Array","argumentsLength","arguments","length","mapfn","undefined","mapping","iteratorMethod","index","result","step","iterator","next","value","call","done"],"mappings":"AAAA;;AACA,IAA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EAA2F;AACzFI,IAAAA,QAAQ,GAAGJ,cAAc,CAACO,IAAf,CAAoBhB,CAApB,CAAX;AACAc,IAAAA,IAAI,GAAGD,QAAQ,CAACC,IAAhB;AACAH,IAAAA,MAAM,GAAG,IAAIV,CAAJ,EAAT;;AACA,WAAM,CAAC,CAACW,IAAI,GAAGE,IAAI,CAACE,IAAL,CAAUH,QAAV,CAAR,EAA6BI,IAApC,EAA0CP,KAAK,EAA/C,EAAmD;AACjDK,MAAAA,KAAK,GAAGP,OAAO,GAAGjB,4BAA4B,CAACsB,QAAD,EAAWP,KAAX,EAAkB,CAACM,IAAI,CAACG,KAAN,EAAaL,KAAb,CAAlB,EAAuC,IAAvC,CAA/B,GAA8EE,IAAI,CAACG,KAAlG;AACArB,MAAAA,cAAc,CAACiB,MAAD,EAASD,KAAT,EAAgBK,KAAhB,CAAd;AACD;AACF,GARD,MAQO;AACLV,IAAAA,MAAM,GAAGZ,QAAQ,CAACO,CAAC,CAACK,MAAH,CAAjB;AACAM,IAAAA,MAAM,GAAG,IAAIV,CAAJ,CAAMI,MAAN,CAAT;;AACA,WAAMA,MAAM,GAAGK,KAAf,EAAsBA,KAAK,EAA3B,EAA+B;AAC7BK,MAAAA,KAAK,GAAGP,OAAO,GAAGF,KAAK,CAACN,CAAC,CAACU,KAAD,CAAF,EAAWA,KAAX,CAAR,GAA4BV,CAAC,CAACU,KAAD,CAA5C;AACAhB,MAAAA,cAAc,CAACiB,MAAD,EAASD,KAAT,EAAgBK,KAAhB,CAAd;AACD;AACF;;AACDJ,EAAAA,MAAM,CAACN,MAAP,GAAgBK,KAAhB;AACA,SAAOC,MAAP;AACD,CA7BD","sourcesContent":["'use strict';\nvar bind = require('../internals/function-bind-context');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar toLength = require('../internals/to-length');\nvar createProperty = require('../internals/create-property');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\n// `Array.from` method implementation\n// https://tc39.es/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = iteratorMethod.call(O);\n next = iterator.next;\n result = new C();\n for (;!(step = next.call(iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = toLength(O.length);\n result = new C(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n"]},"metadata":{},"sourceType":"script"}