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:
837 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var flattenIntoArray = require('../internals/flatten-into-array');
|
---|
| 4 | var aCallable = require('../internals/a-callable');
|
---|
| 5 | var toObject = require('../internals/to-object');
|
---|
| 6 | var lengthOfArrayLike = require('../internals/length-of-array-like');
|
---|
| 7 | var arraySpeciesCreate = require('../internals/array-species-create');
|
---|
| 8 |
|
---|
| 9 | // `Array.prototype.flatMap` method
|
---|
| 10 | // https://tc39.es/ecma262/#sec-array.prototype.flatmap
|
---|
| 11 | $({ target: 'Array', proto: true }, {
|
---|
| 12 | flatMap: function flatMap(callbackfn /* , thisArg */) {
|
---|
| 13 | var O = toObject(this);
|
---|
| 14 | var sourceLen = lengthOfArrayLike(O);
|
---|
| 15 | var A;
|
---|
| 16 | aCallable(callbackfn);
|
---|
| 17 | A = arraySpeciesCreate(O, 0);
|
---|
| 18 | A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
---|
| 19 | return A;
|
---|
| 20 | }
|
---|
| 21 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.