source: trip-planner-front/node_modules/core-js/internals/array-species-constructor.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 683 bytes
Line 
1var isObject = require('../internals/is-object');
2var isArray = require('../internals/is-array');
3var wellKnownSymbol = require('../internals/well-known-symbol');
4
5var SPECIES = wellKnownSymbol('species');
6
7// a part of `ArraySpeciesCreate` abstract operation
8// https://tc39.es/ecma262/#sec-arrayspeciescreate
9module.exports = function (originalArray) {
10 var C;
11 if (isArray(originalArray)) {
12 C = originalArray.constructor;
13 // cross-realm fallback
14 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
15 else if (isObject(C)) {
16 C = C[SPECIES];
17 if (C === null) C = undefined;
18 }
19 } return C === undefined ? Array : C;
20};
Note: See TracBrowser for help on using the repository browser.