source: imaps-frontend/node_modules/core-js/modules/es.array.flat.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 865 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var flattenIntoArray = require('../internals/flatten-into-array');
4var toObject = require('../internals/to-object');
5var lengthOfArrayLike = require('../internals/length-of-array-like');
6var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
7var arraySpeciesCreate = require('../internals/array-species-create');
8
9// `Array.prototype.flat` method
10// https://tc39.es/ecma262/#sec-array.prototype.flat
11$({ target: 'Array', proto: true }, {
12 flat: function flat(/* depthArg = 1 */) {
13 var depthArg = arguments.length ? arguments[0] : undefined;
14 var O = toObject(this);
15 var sourceLen = lengthOfArrayLike(O);
16 var A = arraySpeciesCreate(O, 0);
17 A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
18 return A;
19 }
20});
Note: See TracBrowser for help on using the repository browser.