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
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var DefineOwnProperty = require('../helpers/DefineOwnProperty');
|
---|
6 |
|
---|
7 | var FromPropertyDescriptor = require('./FromPropertyDescriptor');
|
---|
8 | var IsDataDescriptor = require('./IsDataDescriptor');
|
---|
9 | var IsPropertyKey = require('./IsPropertyKey');
|
---|
10 | var SameValue = require('./SameValue');
|
---|
11 | var Type = require('./Type');
|
---|
12 |
|
---|
13 | // https://262.ecma-international.org/6.0/#sec-createmethodproperty
|
---|
14 |
|
---|
15 | module.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.