JSPM

  • Created
  • Published
  • Downloads 8968
  • Score
    100M100P100Q130751F
  • License MIT

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

Package Exports

  • is-nan-x

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-nan-x) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Travis status Dependency status devDependency status npm version

is-nan-x

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

Version: 1.0.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

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.

Param Type Description
value * The value to be tested for NaN.

Example

var numberIsNaN = require('is-nan-x');

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

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

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