UNPKG

516 BJavaScriptView Raw
1var anObject = require('../internals/an-object');
2var aFunction = require('../internals/a-function');
3var wellKnownSymbol = require('../internals/well-known-symbol');
4
5var SPECIES = wellKnownSymbol('species');
6
7// `SpeciesConstructor` abstract operation
8// https://tc39.github.io/ecma262/#sec-speciesconstructor
9module.exports = function (O, defaultConstructor) {
10 var C = anObject(O).constructor;
11 var S;
12 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
13};