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
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 4 | var $TypeError = require('es-errors/type');
|
---|
| 5 |
|
---|
| 6 | var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor');
|
---|
| 7 | var IsArray = require('./IsArray');
|
---|
| 8 | var OrdinaryObjectCreate = require('./OrdinaryObjectCreate');
|
---|
| 9 |
|
---|
| 10 | // https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor
|
---|
| 11 |
|
---|
| 12 | module.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.