Node-Red configuration
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.

es.array.flat-map.js 837B

123456789101112131415161718192021
  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. // `Array.prototype.flatMap` method
  9. // https://tc39.es/ecma262/#sec-array.prototype.flatmap
  10. $({ target: 'Array', proto: true }, {
  11. flatMap: function flatMap(callbackfn /* , thisArg */) {
  12. var O = toObject(this);
  13. var sourceLen = lengthOfArrayLike(O);
  14. var A;
  15. aCallable(callbackfn);
  16. A = arraySpeciesCreate(O, 0);
  17. A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  18. return A;
  19. }
  20. });