New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

es-env-aggressive-nan

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-env-aggressive-nan

Tracking and getting rid of all NaNs!

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

es-env-aggressive-nan

Tracking and getting rid of all NaNs!

WARNING! this will turn the ECMAScript environment you're running to a non-standard one. Your own code or some dependency code may break as a result.

This piece of code is meant to be used only during development, not in production. The goal is to throw as soon as NaN appears (instead of letting NaNs flow in other places of the program).

Install

npm install es-env-aggressive-nan --save

How to use it

Just require it before anything else. Beware, this may break dependent packages. Use at your own risk!

require('es-env-aggressive-nan');

Limitations

This script only wraps functions that may return NaN (and might take a NaN as argument). It does not cover finding when a variable is purposefully set to NaN (you do that at your own risk), nor syntactic patterns that result in NaN being generated like:

var i;
console.log(+i);

The wrapping may result in a minor performance hit that is deemed acceptable given it is only happening in development phase and not in production.

For now, this has only been tested and used on Node.js™ 0.10. It should work fine on 0.12 and io.js but in the unlikely case you run into problems, please file an issue.

Changes

The functions that are wrapped are:

  • own properties of Math, Number, Number.prototype, Date, Date.prototype
  • parseInt
  • parseFloat
  • Number
  • Date
  • String.prototype.charCodeAt

Licence

ISC

Keywords

FAQs

Package last updated on 08 Mar 2015

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