aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/es.array.flat-map.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/modules/es.array.flat-map.js')
-rw-r--r--node_modules/core-js/modules/es.array.flat-map.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/es.array.flat-map.js b/node_modules/core-js/modules/es.array.flat-map.js
new file mode 100644
index 0000000..5469bee
--- /dev/null
+++ b/node_modules/core-js/modules/es.array.flat-map.js
@@ -0,0 +1,21 @@
+'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://github.com/tc39/proposal-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;
+ }
+});