|
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 |
|
|---|
| 3 | var $gOPD = require('gopd');
|
|---|
| 4 | var $TypeError = require('es-errors/type');
|
|---|
| 5 | var isObject = require('es-object-atoms/isObject');
|
|---|
| 6 | var callBound = require('call-bound');
|
|---|
| 7 |
|
|---|
| 8 | var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
|
|---|
| 9 |
|
|---|
| 10 | var hasOwn = require('hasown');
|
|---|
| 11 |
|
|---|
| 12 | var IsArray = require('./IsArray');
|
|---|
| 13 | var isPropertyKey = require('../helpers/isPropertyKey');
|
|---|
| 14 | var IsRegExp = require('./IsRegExp');
|
|---|
| 15 | var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
|---|
| 16 |
|
|---|
| 17 | // https://262.ecma-international.org/6.0/#sec-ordinarygetownproperty
|
|---|
| 18 |
|
|---|
| 19 | module.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.