source: imaps-frontend/node_modules/es-abstract/2022/CreateNonEnumerableDataPropertyOrThrow.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: 737 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var DefinePropertyOrThrow = require('./DefinePropertyOrThrow');
6var IsPropertyKey = require('./IsPropertyKey');
7var Type = require('./Type');
8
9// https://262.ecma-international.org/13.0/#sec-createnonenumerabledatapropertyorthrow
10
11module.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.