You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
'use strict'; var $ = require('../internals/export'); var flattenIntoArray = require('../internals/flatten-into-array'); var toObject = require('../internals/to-object'); var toLength = require('../internals/to-length'); var aFunction = require('../internals/a-function'); var arraySpeciesCreate = require('../internals/array-species-create');
// `Array.prototype.flatMap` method
// https://tc39.es/ecma262/#sec-array.prototype.flatmap
$({ target: 'Array', proto: true }, { flatMap: function flatMap(callbackfn /* , thisArg */) { var O = toObject(this); var sourceLen = toLength(O.length); var A; aFunction(callbackfn); A = arraySpeciesCreate(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); return A; } });
|