source: imaps-frontend/node_modules/es-abstract/2021/DefinePropertyOrThrow.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: 1.1 KB
RevLine 
[d565449]1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var isPropertyDescriptor = require('../helpers/records/property-descriptor');
6var DefineOwnProperty = require('../helpers/DefineOwnProperty');
7
8var FromPropertyDescriptor = require('./FromPropertyDescriptor');
9var IsDataDescriptor = require('./IsDataDescriptor');
[79a0317]10var isPropertyKey = require('../helpers/isPropertyKey');
[d565449]11var SameValue = require('./SameValue');
12var ToPropertyDescriptor = require('./ToPropertyDescriptor');
[79a0317]13
14var isObject = require('../helpers/isObject');
[d565449]15
16// https://262.ecma-international.org/6.0/#sec-definepropertyorthrow
17
18module.exports = function DefinePropertyOrThrow(O, P, desc) {
[79a0317]19 if (!isObject(O)) {
[d565449]20 throw new $TypeError('Assertion failed: Type(O) is not Object');
21 }
22
[79a0317]23 if (!isPropertyKey(P)) {
24 throw new $TypeError('Assertion failed: P is not a Property Key');
[d565449]25 }
26
27 var Desc = isPropertyDescriptor(desc) ? desc : ToPropertyDescriptor(desc);
28 if (!isPropertyDescriptor(Desc)) {
29 throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
30 }
31
32 return DefineOwnProperty(
33 IsDataDescriptor,
34 SameValue,
35 FromPropertyDescriptor,
36 O,
37 P,
38 Desc
39 );
40};
Note: See TracBrowser for help on using the repository browser.