TritonDataCenter / node-assert-plus

Extra assertions on top of node's assert module
MIT License
122 stars 25 forks source link

assert.number(NaN) should fail or add assert.finite #4

Closed adamschmideg closed 11 years ago

adamschmideg commented 12 years ago

I'd expect assert.number(NaN) to fail, but it doesn't. Either it should fail, or you can add assert.finite which fails for NaN.

brycebaril commented 11 years ago

+1

I'm hitting this same issue when writing a restify pull request. I also think it would make things a lot cleaner if NaN failed for assert.number(NaN)

mcavage commented 11 years ago

Agreed. Should be easy to fix.

On Thu, Apr 18, 2013 at 10:34 AM, Bryce Baril notifications@github.comwrote:

+1

I'm hitting this same issue when writing a restify pull request. I also think it would make things a lot cleaner if NaN failed for assert.number(NaN)

— Reply to this email directly or view it on GitHubhttps://github.com/mcavage/node-assert-plus/issues/4#issuecomment-16590965 .

trentm commented 8 years ago

Node that assert-plus@1.0.0 changed this again to allow infinity in assert.number (e.g. Infinity) and added assert.finite. I can't help but think that disallowing Infinity for assert.number wasn't totally expected/intended.