diff --git a/lib/contextify.js b/lib/contextify.js index 8171202..5535406 100644 --- a/lib/contextify.js +++ b/lib/contextify.js @@ -560,8 +560,14 @@ Decontextify.value = (value, traps, deepTraps, flags, mock) => { case 'undefined': return undefined; - default: // string, number, boolean, symbol + case 'string': + case 'number': + case 'boolean': + case 'symbol': 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 +951,14 @@ Contextify.value = (value, traps, deepTraps, flags, mock) => { case 'undefined': return undefined; - default: // string, number, boolean, symbol + case 'string': + case 'number': + case 'boolean': + case 'symbol': 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.