-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle NaN #75
Handle NaN #75
Conversation
test/15-elements-maps.js
Outdated
var toEncode = { a: NaN, hello: 'world' } | ||
var buf = instance.encode(toEncode) | ||
|
||
t.deepEqual(expected, instance.decode(buf), 'must ignore NaN') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? Shouldn't it have the same behavior as encoded directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did it same as for undefined
value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are different. The behavior of undefined
is matching how JSON.stringify() works. undefined
in javascript means "there is nothing here". NaN
has a different meaning altogether. It should throw anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will remove that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes: #74.