source: imaps-frontend/node_modules/es-abstract/2024/OrdinaryCreateFromConstructor.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 825 bytes
RevLine 
[d565449]1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4var $TypeError = require('es-errors/type');
5
6var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor');
7var IsArray = require('./IsArray');
8var OrdinaryObjectCreate = require('./OrdinaryObjectCreate');
9
10// https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor
11
12module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) {
13 GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
14 var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto);
15 var slots = arguments.length < 3 ? [] : arguments[2];
16 if (!IsArray(slots)) {
17 throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List');
18 }
19 return OrdinaryObjectCreate(proto, slots);
20};
Note: See TracBrowser for help on using the repository browser.