Version 1
[yaffs-website] / node_modules / core-js / library / modules / _array-species-constructor.js
1 var isObject = require('./_is-object')
2   , isArray  = require('./_is-array')
3   , SPECIES  = require('./_wks')('species');
4
5 module.exports = function(original){
6   var C;
7   if(isArray(original)){
8     C = original.constructor;
9     // cross-realm fallback
10     if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
11     if(isObject(C)){
12       C = C[SPECIES];
13       if(C === null)C = undefined;
14     }
15   } return C === undefined ? Array : C;
16 };