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

fast-isnumeric

Package Overview
Dependencies
Maintainers
13
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-isnumeric

The fast way to check if a JS object is numeric

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
187K
increased by8.6%
Maintainers
13
Weekly downloads
 
Created
Source

fast-isnumeric

The fast way to check if a JS object is numeric

Install

npm install fast-isnumeric

API

var isNumeric = require('fast-isnumeric');

isNumeric(/* any JS object */);

How fast

Run comparison on jsperf: http://jsperf.com/isnumeric-jquery-and-alternate/5

Warning

Please look up the test cases in test.js before using this module.

Most importantly, fast-isnumeric returns false on number and string constructors. That is, isNumeric(new Number(1)) and isNumeric(new String('1')) are false.

Tests

Test locally with karma:

npm test

Why?

In plotly's javascript graphing library plotly.js numerical objects must be accounted for in numerous hot code paths. Inspired by Jon Schlinkert's is-number, fast-isnumeric is significantly simplified and sped up by ignoring number and string constructors.

Author

Alex Johnson | https://github.com/alexcjohnson

License

Copyright (c) 2015 Alex Johnson Released under the MIT license.

Keywords

FAQs

Package last updated on 06 Apr 2020

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