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:
821 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var reflectGetProto = require('./Reflect.getPrototypeOf');
|
---|
| 4 | var originalGetProto = require('./Object.getPrototypeOf');
|
---|
| 5 |
|
---|
| 6 | var getDunderProto = require('dunder-proto/get');
|
---|
| 7 |
|
---|
| 8 | /** @type {import('.')} */
|
---|
| 9 | module.exports = reflectGetProto
|
---|
| 10 | ? function getProto(O) {
|
---|
| 11 | // @ts-expect-error TS can't narrow inside a closure, for some reason
|
---|
| 12 | return reflectGetProto(O);
|
---|
| 13 | }
|
---|
| 14 | : originalGetProto
|
---|
| 15 | ? function getProto(O) {
|
---|
| 16 | if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
|
---|
| 17 | throw new TypeError('getProto: not an object');
|
---|
| 18 | }
|
---|
| 19 | // @ts-expect-error TS can't narrow inside a closure, for some reason
|
---|
| 20 | return originalGetProto(O);
|
---|
| 21 | }
|
---|
| 22 | : getDunderProto
|
---|
| 23 | ? function getProto(O) {
|
---|
| 24 | // @ts-expect-error TS can't narrow inside a closure, for some reason
|
---|
| 25 | return getDunderProto(O);
|
---|
| 26 | }
|
---|
| 27 | : null;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.