source: imaps-frontend/node_modules/dunder-proto/get.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 980 bytes
Line 
1'use strict';
2
3var callBind = require('call-bind-apply-helpers');
4var gOPD = require('gopd');
5
6var hasProtoAccessor;
7try {
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
17var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
18
19var $Object = Object;
20var $getPrototypeOf = $Object.getPrototypeOf;
21
22/** @type {import('./get')} */
23module.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.