Socket
Socket
Sign inDemoInstall

is-odd

Package Overview
Dependencies
1
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 3.0.0

25

index.js

@@ -10,12 +10,23 @@ /*!

var isNumber = require('is-number');
const isNumber = require('is-number');
module.exports = function isOdd(i) {
if (!isNumber(i)) {
throw new TypeError('is-odd expects a number.');
module.exports = function isOdd(value) {
const n = Math.abs(value);
if (!isNumber(n)) {
throw new TypeError('expected a number');
}
if (Number(i) !== Math.floor(i)) {
throw new RangeError('is-odd expects an integer.');
if (!Number.isInteger(n)) {
throw new Error('expected an integer');
}
return !!(~~i & 1);
if (!isSafeInteger(n)) {
throw new Error('value exceeds maximum safe integer');
}
return (n % 2) === 1;
};
function isSafeInteger(n) {
if (typeof Number.isSafeInteger === 'function') {
return Number.isInteger(n) && (n <= Number.MAX_SAFE_INTEGER);
}
return Number.isSafeInteger(n);
}
{
"name": "is-odd",
"description": "Returns true if the given number is odd.",
"version": "2.0.0",
"description": "Returns true if the given number is odd, and is an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.",
"version": "3.0.0",
"homepage": "https://github.com/jonschlinkert/is-odd",

@@ -23,3 +23,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"engines": {
"node": ">=0.10.0"
"node": ">=4"
},

@@ -30,7 +30,7 @@ "scripts": {

"dependencies": {
"is-number": "^4.0.0"
"is-number": "^6.0.0"
},
"devDependencies": {
"gulp-format-md": "^1.0.0",
"mocha": "^4.0.1"
"mocha": "^3.5.3"
},

@@ -37,0 +37,0 @@ "keywords": [

# is-odd [![NPM version](https://img.shields.io/npm/v/is-odd.svg?style=flat)](https://www.npmjs.com/package/is-odd) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-odd.svg?style=flat)](https://npmjs.org/package/is-odd) [![NPM total downloads](https://img.shields.io/npm/dt/is-odd.svg?style=flat)](https://npmjs.org/package/is-odd) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-odd.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-odd)
> Returns true if the given number is odd.
> Returns true if the given number is odd, and is an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER.

@@ -17,13 +17,12 @@ Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.

Works with strings or numbers.
```js
var isOdd = require('is-odd');
const isOdd = require('is-odd');
isOdd(0);
//=> false
isOdd('1');
//=> true
isOdd(2);
//=> false
isOdd('3');
//=> true
console.log(isOdd('1')); //=> true
console.log(isOdd('3')); //=> true
console.log(isOdd(0)); //=> false
console.log(isOdd(2)); //=> false
```

@@ -76,4 +75,4 @@

| --- | --- |
| 11 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [noformnocontent](https://github.com/noformnocontent) |
| 15 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [dym-sh](https://github.com/dym-sh) |
| 1 | [Semigradsky](https://github.com/Semigradsky) |

@@ -86,8 +85,9 @@ | 1 | [realityking](https://github.com/realityking) |

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

@@ -97,2 +97,2 @@

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on November 01, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 30, 2018._

Sorry, the diff of this file is not supported yet

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