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:
980 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var callBind = require('call-bind-apply-helpers');
|
---|
| 4 | var gOPD = require('gopd');
|
---|
| 5 |
|
---|
| 6 | var hasProtoAccessor;
|
---|
| 7 | try {
|
---|
| 8 | // eslint-disable-next-line no-extra-parens, no-proto
|
---|
| 9 | hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
---|
| 10 | } catch (e) {
|
---|
| 11 | if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
---|
| 12 | throw e;
|
---|
| 13 | }
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | // eslint-disable-next-line no-extra-parens
|
---|
| 17 | var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
---|
| 18 |
|
---|
| 19 | var $Object = Object;
|
---|
| 20 | var $getPrototypeOf = $Object.getPrototypeOf;
|
---|
| 21 |
|
---|
| 22 | /** @type {import('./get')} */
|
---|
| 23 | module.exports = desc && typeof desc.get === 'function'
|
---|
| 24 | ? callBind([desc.get])
|
---|
| 25 | : typeof $getPrototypeOf === 'function'
|
---|
| 26 | ? /** @type {import('./get')} */ function getDunder(value) {
|
---|
| 27 | // eslint-disable-next-line eqeqeq
|
---|
| 28 | return $getPrototypeOf(value == null ? value : $Object(value));
|
---|
| 29 | }
|
---|
| 30 | : false;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.