diff --git a/lib/contextify.js b/lib/contextify.js index 8171202..d6ba2f2 100644 --- a/lib/contextify.js +++ b/lib/contextify.js @@ -560,8 +560,15 @@ Decontextify.value = (value, traps, deepTraps, flags, mock) => { case 'undefined': return undefined; - default: // string, number, boolean, symbol + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': return value; + + default: // new, unknown types can be dangerous + return null; } } catch (ex) { // 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) => { case 'undefined': return undefined; - default: // string, number, boolean, symbol + case 'string': + case 'number': + case 'boolean': + case 'symbol': + case 'bigint': return value; + + default: // new, unknown types can be dangerous + return null; } } catch (ex) { // Never pass the handled exception through! This block can't throw an exception under normal conditions.