source: imaps-frontend/node_modules/es-abstract/2016/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: 801 bytes
Line 
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 ObjectCreate = require('./ObjectCreate');
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 ObjectCreate(proto, slots);
20};
Note: See TracBrowser for help on using the repository browser.