aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/get-proto/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/get-proto/index.js')
-rw-r--r--node_modules/get-proto/index.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/get-proto/index.js b/node_modules/get-proto/index.js
new file mode 100644
index 0000000..7e5747b
--- /dev/null
+++ b/node_modules/get-proto/index.js
@@ -0,0 +1,27 @@
+'use strict';
+
+var reflectGetProto = require('./Reflect.getPrototypeOf');
+var originalGetProto = require('./Object.getPrototypeOf');
+
+var getDunderProto = require('dunder-proto/get');
+
+/** @type {import('.')} */
+module.exports = reflectGetProto
+ ? function getProto(O) {
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
+ return reflectGetProto(O);
+ }
+ : originalGetProto
+ ? function getProto(O) {
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
+ throw new TypeError('getProto: not an object');
+ }
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
+ return originalGetProto(O);
+ }
+ : getDunderProto
+ ? function getProto(O) {
+ // @ts-expect-error TS can't narrow inside a closure, for some reason
+ return getDunderProto(O);
+ }
+ : null;