diff options
Diffstat (limited to 'node_modules/core-js/modules/_array-species-constructor.js')
-rw-r--r-- | node_modules/core-js/modules/_array-species-constructor.js | 16 |
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 000000000..a715389fd --- /dev/null +++ b/node_modules/core-js/modules/_array-species-constructor.js @@ -0,0 +1,16 @@ +var isObject = require('./_is-object') + , isArray = require('./_is-array') + , 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; +};
\ No newline at end of file |