Skip to content

Commit

Permalink
Merge pull request #375 from XmiliaH/fix-374
Browse files Browse the repository at this point in the history
Specs may add more types to typeof.
  • Loading branch information
XmiliaH authored Oct 20, 2021
2 parents 8b9d039 + c9cbff6 commit 7505410
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions lib/contextify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7505410

Please sign in to comment.