is-nan
ES2015-compliant shim for Number.isNaN - the global isNaN returns false positives.
This package has a good security score with no known vulnerabilities.
Community Reviews
Tiny, Zero-Overhead Polyfill for Correct NaN Detection
From an operations perspective, this is the ideal dependency: trivial bundle size (under 1KB), no external dependencies, no configuration surface area to manage, and no runtime state. It either polyfills the native method or uses it directly. There are no connection pools, no retries, no timeouts - it's a pure function that executes in microseconds. The only consideration is whether you actually need it, since all modern Node versions (6+) and browsers have native Number.isNaN support.
The main value is in legacy environments or when you need absolute consistency across runtime versions. For greenfield projects targeting modern Node (14+), you can just use Number.isNaN directly.
Best for: Projects requiring consistent NaN detection across legacy and modern environments, or strict ES2015 compliance guarantees.
Avoid if: You're only targeting Node 6+ or modern browsers and can use native Number.isNaN directly.
Simple, reliable NaN detection for legacy JavaScript environments
The practical benefit is handling the quirk where global isNaN('string') returns true, while Number.isNaN('string') correctly returns false. This shim behaves like the modern standard, only returning true for actual NaN values. In day-to-day use, it's invisible - which is exactly what you want from a polyfill.
The main consideration is whether you need it at all. Modern browsers and Node.js versions have had Number.isNaN for years. But if you're supporting older environments or want consistent behavior without checking feature support yourself, this package is bulletproof. The codebase is small, well-tested, and maintained by someone deeply involved in JavaScript standards.
Best for: Projects supporting older JavaScript environments or needing a reliable polyfill for Number.isNaN.
Avoid if: You only target modern browsers/Node.js versions where Number.isNaN is already available.
Simple, reliable polyfill that just works - minimal footprint, minimal friction
In practice, this is the kind of dependency you add once and never think about again. It's particularly useful when you need to support older environments or want consistent behavior across all runtimes. The implementation is battle-tested and the package has zero dependencies, making it a safe addition to any project.
The main limitation is documentation - the README is sparse. While the API is simple enough that this isn't a major issue, newcomers unfamiliar with the difference between isNaN and Number.isNaN might benefit from more context about why this package exists and when to use it.
Best for: Projects needing reliable NaN checking across all environments including legacy browsers.
Avoid if: You only target modern browsers and can use native Number.isNaN directly without polyfills.
Sign in to write a review
Sign In