Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-nan-x

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-nan-x

ES6-compliant shim for Number.isNaN - the global isNaN returns false positives.

  • 2.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
704
decreased by-80.55%
Maintainers
1
Weekly downloads
 
Created
Source

Travis status Dependency status devDependency status npm version

is-nan-x

ES6-compliant shim for Number.isNaN - the global isNaN returns false positives.

module.exports(value)boolean

This method determines whether the passed value is NaN and its type is Number. It is a more robust version of the original, global isNaN().

Kind: Exported function
Returns: boolean - true if the given value is NaN and its type is Number; otherwise, false.

ParamTypeDescription
value*The value to be tested for NaN.

Example

import numberIsNaN from 'is-nan-x';

console.log(numberIsNaN(NaN)); // true
console.log(numberIsNaN(Number.NaN)); // true
console.log(numberIsNaN(0 / 0)); // true

// e.g. these would have been true with global isNaN()
console.log(numberIsNaN('NaN')); // false
console.log(numberIsNaN(undefined)); // false
console.log(numberIsNaN({}); // false
console.log(numberIsNaN('blabla')); // false

// These all return false
console.log(numberIsNaN(true));
console.log(numberIsNaN(null));
console.log(numberIsNaN(37));
console.log(numberIsNaN('37'));
console.log(numberIsNaN('37.37'));
console.log(numberIsNaN(''));
console.log(numberIsNaN(' '));

Keywords

FAQs

Package last updated on 16 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc