Skip to content

Commit

Permalink
Specs may add more types to typeof.
Browse files Browse the repository at this point in the history
Default these values to null.
  • Loading branch information
XmiliaH committed Oct 20, 2021
1 parent 8b9d039 commit 3482787
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/contextify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3482787

Please sign in to comment.