aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/modules/_array-species-constructor.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/modules/_array-species-constructor.js')
-rw-r--r--node_modules/core-js/modules/_array-species-constructor.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/node_modules/core-js/modules/_array-species-constructor.js b/node_modules/core-js/modules/_array-species-constructor.js
new file mode 100644
index 00000000..0771c236
--- /dev/null
+++ b/node_modules/core-js/modules/_array-species-constructor.js
@@ -0,0 +1,16 @@
+var isObject = require('./_is-object');
+var isArray = require('./_is-array');
+var SPECIES = require('./_wks')('species');
+
+module.exports = function (original) {
+ var C;
+ if (isArray(original)) {
+ C = original.constructor;
+ // cross-realm fallback
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
+ if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ } return C === undefined ? Array : C;
+};