source: frontend/node_modules/es-abstract/2023/OrdinaryGetOwnProperty.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2
3var $gOPD = require('gopd');
4var $TypeError = require('es-errors/type');
5var isObject = require('es-object-atoms/isObject');
6var callBound = require('call-bound');
7
8var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
9
10var hasOwn = require('hasown');
11
12var IsArray = require('./IsArray');
13var isPropertyKey = require('../helpers/isPropertyKey');
14var IsRegExp = require('./IsRegExp');
15var ToPropertyDescriptor = require('./ToPropertyDescriptor');
16
17// https://262.ecma-international.org/6.0/#sec-ordinarygetownproperty
18
19module.exports = function OrdinaryGetOwnProperty(O, P) {
20 if (!isObject(O)) {
21 throw new $TypeError('Assertion failed: O must be an Object');
22 }
23 if (!isPropertyKey(P)) {
24 throw new $TypeError('Assertion failed: P must be a Property Key');
25 }
26 if (!hasOwn(O, P)) {
27 return void 0;
28 }
29 if (!$gOPD) {
30 // ES3 / IE 8 fallback
31 var arrayLength = IsArray(O) && P === 'length';
32 var regexLastIndex = IsRegExp(O) && P === 'lastIndex';
33 return {
34 '[[Configurable]]': !(arrayLength || regexLastIndex),
35 '[[Enumerable]]': $isEnumerable(O, P),
36 '[[Value]]': O[P],
37 '[[Writable]]': true
38 };
39 }
40 return ToPropertyDescriptor($gOPD(O, P));
41};
Note: See TracBrowser for help on using the repository browser.