Skip to content

Commit 3a21c36

Browse files
committed
Merge branch 'master' of https://github.com/patriksimek/vm2
2 parents d03f150 + 7505410 commit 3a21c36

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

‎lib/contextify.js‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,15 @@ Decontextify.value = (value, traps, deepTraps, flags, mock) => {
560560
case 'undefined':
561561
return undefined;
562562

563-
default: // string, number, boolean, symbol
563+
case 'string':
564+
case 'number':
565+
case 'boolean':
566+
case 'symbol':
567+
case 'bigint':
564568
return value;
569+
570+
default: // new, unknown types can be dangerous
571+
return null;
565572
}
566573
} catch (ex) {
567574
// Never pass the handled exception through! This block can't throw an exception under normal conditions.
@@ -945,8 +952,15 @@ Contextify.value = (value, traps, deepTraps, flags, mock) => {
945952
case 'undefined':
946953
return undefined;
947954

948-
default: // string, number, boolean, symbol
955+
case 'string':
956+
case 'number':
957+
case 'boolean':
958+
case 'symbol':
959+
case 'bigint':
949960
return value;
961+
962+
default: // new, unknown types can be dangerous
963+
return null;
950964
}
951965
} catch (ex) {
952966
// Never pass the handled exception through! This block can't throw an exception under normal conditions.

0 commit comments

Comments
 (0)