Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
ES2015-compliant shim for Number.isNaN - the global isNaN returns false positives.
The is-nan npm package is a simple utility that provides a reliable way to check if a value is NaN (Not-a-Number) in JavaScript. It is especially useful because it handles some edge cases that the global isNaN() function does not correctly address.
Check for NaN
This feature allows you to check if a value is NaN. It is more reliable than the native isNaN function because it correctly identifies only the values that are truly NaN, without coercion.
var isNaN = require('is-nan');
console.log(isNaN(NaN)); // true
console.log(isNaN('NaN')); // false
console.log(isNaN(0/0)); // true
Lodash provides a method called _.isNaN which is similar to is-nan. It checks if a value is NaN. Lodash's implementation is part of a larger utility library, which means it might be preferable if you're already using Lodash in your project.
This package offers a polyfill for Number.isNaN, which is a standard method introduced in ES6. It is similar to is-nan but is specifically a polyfill for the Number.isNaN function, which is not available in older environments.
ES2015-compliant shim for Number.isNaN - the global isNaN returns false positives.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
Number.isNaN = require('is-nan');
var assert = require('assert');
assert.notOk(Number.isNaN(undefined));
assert.notOk(Number.isNaN(null));
assert.notOk(Number.isNaN(false));
assert.notOk(Number.isNaN(true));
assert.notOk(Number.isNaN(0));
assert.notOk(Number.isNaN(42));
assert.notOk(Number.isNaN(Infinity));
assert.notOk(Number.isNaN(-Infinity));
assert.notOk(Number.isNaN('foo'));
assert.notOk(Number.isNaN(function () {}));
assert.notOk(Number.isNaN([]));
assert.notOk(Number.isNaN({}));
assert.ok(Number.isNaN(NaN));
Simply clone the repo, npm install
, and run npm test
FAQs
ES2015-compliant shim for Number.isNaN - the global isNaN returns false positives.
The npm package is-nan receives a total of 4,659,626 weekly downloads. As such, is-nan popularity was classified as popular.
We found that is-nan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.