From 8da47da0f93d0cfd0f784e7878d0c4f62955ba98 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Wed, 16 Apr 2025 16:17:43 +0700 Subject: [PATCH] fix(lib): simplify type checks --- lib/modules/src/metro/utils.ts | 2 +- lib/utils/src/proxy.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/src/metro/utils.ts b/lib/modules/src/metro/utils.ts index 0bfa587..c86142f 100644 --- a/lib/modules/src/metro/utils.ts +++ b/lib/modules/src/metro/utils.ts @@ -79,7 +79,7 @@ export function isModuleExportsBad(exports: Metro.ModuleExports): boolean { // Isn't an object or function? // - Number exports are not useful, usually just an asset ID // - String, Boolean, Symbol, BigInt exports are not useful (who would do `module.exports = ...`?) - !(typeof exports === 'object' || exports.__proto__ === Function.prototype) || + !(typeof exports === 'object' || typeof exports === 'function') || // Checking if the object is empty (exports.__proto__ === Object.prototype && !Reflect.ownKeys(exports).length) ) diff --git a/lib/utils/src/proxy.ts b/lib/utils/src/proxy.ts index 761061e..60d2728 100644 --- a/lib/utils/src/proxy.ts +++ b/lib/utils/src/proxy.ts @@ -36,7 +36,7 @@ const _proxifyHandler = { const target = unproxifyFromHint(hint) const val = Reflect.get(target!, p, recv) - if (val && val.__proto__ === Function.prototype) + if (typeof val === 'function') return new Proxy(val, { // If thisArg happens to be a proxified value, we will use the target object instead apply: (fn, thisArg, args) => Reflect.apply(fn, thisArg === recv ? target : thisArg, args),