source: imaps-frontend/node_modules/es-abstract/2023/CreateMethodProperty.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 940 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var DefineOwnProperty = require('../helpers/DefineOwnProperty');
6
7var FromPropertyDescriptor = require('./FromPropertyDescriptor');
8var IsDataDescriptor = require('./IsDataDescriptor');
9var isPropertyKey = require('../helpers/isPropertyKey');
10var SameValue = require('./SameValue');
11
12var isObject = require('../helpers/isObject');
13
14// https://262.ecma-international.org/6.0/#sec-createmethodproperty
15
16module.exports = function CreateMethodProperty(O, P, V) {
17 if (!isObject(O)) {
18 throw new $TypeError('Assertion failed: Type(O) is not Object');
19 }
20
21 if (!isPropertyKey(P)) {
22 throw new $TypeError('Assertion failed: P is not a Property Key');
23 }
24
25 var newDesc = {
26 '[[Configurable]]': true,
27 '[[Enumerable]]': false,
28 '[[Value]]': V,
29 '[[Writable]]': true
30 };
31 return DefineOwnProperty(
32 IsDataDescriptor,
33 SameValue,
34 FromPropertyDescriptor,
35 O,
36 P,
37 newDesc
38 );
39};
Note: See TracBrowser for help on using the repository browser.