jlongster / transducers.js

A small library for generalized transformation of data (inspired by Clojure's transducers)
BSD 2-Clause "Simplified" License
1.73k stars 54 forks source link

isNumber should return false for NaN #21

Closed buzzdecafe closed 9 years ago

buzzdecafe commented 9 years ago

unfortunately, typeof NaN is number. I think that is not the behavior you want. This little patch fixes that.

deepak1556 commented 9 years ago

would Number.isFinite be a better option here ?

jlongster commented 9 years ago

Thanks, but only use these functions to check if certain arguments were passed, so I think it's appropriate to treat NaN as part of that pipeline (you meant to pass a number, but you did something bad beforehand).

Anyway, I'm thinking of refactoring how that argument checking works anyway and I'll probably get rid of these checks.