fix(lib/utils/proxy): cleanup destructure

This commit is contained in:
PalmDevs 2025-04-10 00:55:58 +07:00
parent 9f0656f3a0
commit e39ad598d9
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -169,10 +169,9 @@ export function destructure<T extends object>(proxified: T, options?: ProxifyOpt
const v = unproxify(proxified)[p]
if (v == null) throw new TypeError(`Cannot destructure and proxify ${v} (reading '${String(p)}')`)
if (typeof v === 'function' || typeof v === 'object') return v
// Forcefully proxify primitives
if (typeof v !== 'object' && typeof v !== 'function') return Object(v)
return v
return Object(v)
}, options),
})
}