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

typeof NaN is 'number' #72

Closed
chenxianliang opened this issue Feb 16, 2015 · 7 comments
Closed

typeof NaN is 'number' #72

chenxianliang opened this issue Feb 16, 2015 · 7 comments

Comments

@chenxianliang
Copy link

// is a given value number?
is.number = function(value) {
    return toString.call(value) === '[object Number]';
};

should be
is.number = function(value) {
return toString.call(value) === '[object Number]' && !isNaN(value);
};
???

@arasatasaygin
Copy link
Owner

Type of NaN is number.
What others think? Should we return false for NaN on this check?

Thanks @chenxianliang

@cfj
Copy link
Contributor

cfj commented Feb 25, 2015

NaN may technically be a number but I don't think it's in the spirit of the is.number function to return true on NaN.

@limichange
Copy link

Type of NaN is number.

@Joshua-F
Copy link

I agree with @cfj. NaN stands for Not a Number so I say keep it how it is now it should return false.

@cakuki
Copy link

cakuki commented Feb 25, 2015

@Joshua-F you do not agree with @cfj. Type of NaN is Number, and right now is.number(NaN) returns true.

👍 for change, is.number(NaN) should return false.

@Joshua-F
Copy link

@cakuki, he says he doesn't think it's in the spirit of the is.number function, which I agree with. But to clarify , is.number(NaN) should return false.

@arasatasaygin
Copy link
Owner

Fixed with #79 from @jonhester
Thanks for all the feedbacks. This check returns false for NaN right now.

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

No branches or pull requests

6 participants