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:
737 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var $TypeError = require('es-errors/type');
|
---|
| 4 |
|
---|
| 5 | var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
|
---|
| 6 | var IsPropertyKey = require('./IsPropertyKey');
|
---|
| 7 | var Type = require('./Type');
|
---|
| 8 |
|
---|
| 9 | // https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow
|
---|
| 10 |
|
---|
| 11 | module.exports = function CreateNonEnumerableDataPropertyOrThrow(O, P, V) {
|
---|
| 12 | if (Type(O) !== 'Object') {
|
---|
| 13 | throw new $TypeError('Assertion failed: Type(O) is not Object');
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | if (!IsPropertyKey(P)) {
|
---|
| 17 | throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | var newDesc = {
|
---|
| 21 | '[[Configurable]]': true,
|
---|
| 22 | '[[Enumerable]]': false,
|
---|
| 23 | '[[Value]]': V,
|
---|
| 24 | '[[Writable]]': true
|
---|
| 25 | };
|
---|
| 26 | return DefinePropertyOrThrow(O, P, newDesc);
|
---|
| 27 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.