Skip to content
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

Treat null, undefined, and NaN as viral contaigons #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kriskowal
Copy link
Member

This adds NaN to the list of invalid inputs for operators, such that
they will all propagate as undefined.

For the purpose of determining whether a meaningful value exists to
propagate.
@kriskowal
Copy link
Member Author

I’m sure @mczepiel or @aadsm will want to have a chance to veto. Assigning to @mczepiel.

@mczepiel
Copy link
Contributor

I don't have any particular use case in mind where I know it would have been nice to differentiate encountering undefined from NaN. It just seems like data we had that could be informative. Otherwise sanely stopping evaluation in the same manner as encountering undefined is reasonable.

@kriskowal
Copy link
Member Author

Alternately, I could propagate NaN and use the value != null && value === value throughout FRB to detect and propagate invalid input directly to output. value != null being shorthand for value !== null && value !== void 0 WAT, and value === value being the only reliable way to distinguish NaN and only NaN SUPERWAT void 0 being the only reliable way to express undefined since undefined is a variable that can be, in fact, defined MEGAWAT and isNaN being unsatisfactory because it coerces strings to NaN before checking M-M-MONSTERWAT.

@kriskowal
Copy link
Member Author

Oh, wait. That’s what I did.

@kriskowal
Copy link
Member Author

Oh, no. This would just be a start. I could use this defined method throughout FRB internally and just pass the bad value forward. When I rebase this, I might expand on the comments with above.

@kriskowal kriskowal assigned kriskowal and unassigned mczepiel May 29, 2014
@hthetiot
Copy link
Contributor

@kriskowal could you rebase on master ?

@hthetiot hthetiot self-requested a review December 28, 2017 11:54
@hthetiot hthetiot added this to the 4.0.x milestone Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants