source: imaps-frontend/node_modules/es-abstract/2018/CreateMethodProperty.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 926 bytes
RevLine 
[d565449]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('./IsPropertyKey');
10var SameValue = require('./SameValue');
11var Type = require('./Type');
12
13// https://262.ecma-international.org/6.0/#sec-createmethodproperty
14
15module.exports = function CreateMethodProperty(O, P, V) {
16 if (Type(O) !== 'Object') {
17 throw new $TypeError('Assertion failed: Type(O) is not Object');
18 }
19
20 if (!IsPropertyKey(P)) {
21 throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
22 }
23
24 var newDesc = {
25 '[[Configurable]]': true,
26 '[[Enumerable]]': false,
27 '[[Value]]': V,
28 '[[Writable]]': true
29 };
30 return DefineOwnProperty(
31 IsDataDescriptor,
32 SameValue,
33 FromPropertyDescriptor,
34 O,
35 P,
36 newDesc
37 );
38};
Note: See TracBrowser for help on using the repository browser.