fix(lib): simplify type checks
This commit is contained in:
parent
b29e1bc2f6
commit
8da47da0f9
2 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue