Skip to content

Commit 2ad7508

Browse files
committed
Handling proxy.object(null) and undefined too
1 parent b16e6df commit 2ad7508

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

esm/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ const JSProxy = ($, target, handler, token = $) => {
4242
if (token === $) {
4343
switch (typeof $) {
4444
case OBJECT:
45-
case FUNCTION:
46-
case UNDEFINED: break;
45+
case UNDEFINED: if (!token) token = false;
46+
case FUNCTION: break;
4747
default: {
4848
token = false;
4949
if (target === $) target = Object($);

test/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,6 @@ assert(valueOf(h), 'anything-really');
140140
h = null;
141141
await collect();
142142
assert(i, 3);
143+
proxy.object(null);
144+
proxy.object(void 0);
143145
console.log('OK');

0 commit comments

Comments
 (0)