Socket
Socket
Sign inDemoInstall

is-number

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 1.0.0

2

index.js
/*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License

@@ -6,0 +6,0 @@ */

{
"name": "is-number",
"description": "Is the value a number? Has extensive tests.",
"version": "0.1.1",
"description": "Returns true if the value is a number. comprehensive tests.",
"version": "1.0.0",
"homepage": "https://github.com/jonschlinkert/is-number",

@@ -17,8 +17,6 @@ "author": {

},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jonschlinkert/is-number/blob/master/LICENSE-MIT"
}
],
"license": {
"type": "MIT",
"url": "https://github.com/jonschlinkert/is-number/blob/master/LICENSE-MIT"
},
"main": "index.js",

@@ -31,14 +29,17 @@ "engines": {

},
"files": ["index.js"],
"devDependencies": {
"verb-tag-jscomments": ">= 0.2.0",
"verb": ">= 0.2.6",
"mocha": "*"
"benchmarked": "^0.1.3",
"chalk": "^0.5.1"
},
"keywords": [
"check",
"coerce",
"coercion",
"integer",
"is number",
"is",
"is-number",
"istype",
"javascript",
"kind of",
"math",

@@ -49,6 +50,4 @@ "number",

"typeof",
"util",
"utility",
"value"
]
}
# is-number [![NPM version](https://badge.fury.io/js/is-number.svg)](http://badge.fury.io/js/is-number)
> Returns true if the value is a number. comprehensive tests.
> Is the value a number? Has extensive tests.
To understand some of the rationale behind the decisions made in this library (and to learn about some oddities of number evaluation in JavaScript), [see this gist][gist].
## Install
#### Install with [npm](npmjs.org):
## Install with [npm](npmjs.org)
```bash
npm i is-number --save-dev
npm i is-number --save
```
## Run tests
```bash
npm test
```
## Usage

@@ -25,3 +22,2 @@

### true

@@ -60,2 +56,6 @@

### Infinity
Infinity can be [treated as a number][infinity] in mathematics. Here, it's a number - primarily because 99% of use cases do not require checking for it, but doing so [makes our function 20-35% slower](./benchmark/code/infinity.js) in common use cases.
If you want `Infinity` to be `false`, just do:

@@ -89,6 +89,8 @@

## Notes
Instead of using `isFinite()`, you can also achieve similar results by using something like `((+n+1) / (+n+1) === 1))`, but this alone allows values like `null` to pass as numbers (in JavaScript, the leading `+` coerces the value to a number, [see this gist](https://gist.github.com/jonschlinkert/e30c70c713da325d0e81) for some oddities).
## Run tests
```bash
npm test
```

@@ -103,3 +105,3 @@ ## Author

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license

@@ -109,2 +111,5 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 21, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on January 24, 2015._
[infinity]: http://en.wikipedia.org/wiki/Infinity
[gist]: https://gist.github.com/jonschlinkert/e30c70c713da325d0e81
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc