Skip to content

Commit

Permalink
feat: add support for coerceUndefinedToNull option
Browse files Browse the repository at this point in the history
  • Loading branch information
oed authored and rvagg committed Dec 13, 2021
1 parent cb76924 commit fd61bbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/7float.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ const MINOR_UNDEFINED = 23
* @returns {Token}
*/
export function decodeUndefined (_data, _pos, _minor, options) {
if (options.allowUndefined === false) {
if (options.coerceUndefinedToNull === true) {
return new Token(Type.null, null, 1)
} else if (options.allowUndefined === false) {
throw new Error(`${decodeErrPrefix} undefined values are not supported`)
}
return new Token(Type.undefined, undefined, 1)
Expand Down

0 comments on commit fd61bbe

Please sign in to comment.