source: frontend/node_modules/es-abstract/2018/SpeciesConstructor.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 843 bytes
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $species = GetIntrinsic('%Symbol.species%', true);
6var $TypeError = require('es-errors/type');
7var isObject = require('es-object-atoms/isObject');
8
9var IsConstructor = require('./IsConstructor');
10
11// https://262.ecma-international.org/6.0/#sec-speciesconstructor
12
13module.exports = function SpeciesConstructor(O, defaultConstructor) {
14 if (!isObject(O)) {
15 throw new $TypeError('Assertion failed: Type(O) is not Object');
16 }
17 var C = O.constructor;
18 if (typeof C === 'undefined') {
19 return defaultConstructor;
20 }
21 if (!isObject(C)) {
22 throw new $TypeError('O.constructor is not an Object');
23 }
24 var S = $species ? C[$species] : void 0;
25 if (S == null) {
26 return defaultConstructor;
27 }
28 if (IsConstructor(S)) {
29 return S;
30 }
31 throw new $TypeError('no constructor found');
32};
Note: See TracBrowser for help on using the repository browser.