Check if something is a positive number
JavaScript
Latest commit 97edff6 Mar 23, 2016 @robertpenner robertpenner committed with Improve tests
Fixes #9.
Permalink
Failed to load latest commit information.
.editorconfig Initial commit Jun 2, 2015
.gitattributes Initial commit Jun 2, 2015
.gitignore Initial commit Jun 2, 2015
.travis.yml Test on Node.js v5 and v4 Jan 11, 2016
index.js Accept `Number` object Jan 11, 2016
license Initial commit Jun 2, 2015
package.json 3.1.0 Jan 11, 2016
readme.md ES2015ify tests Jan 11, 2016
test.js Improve tests Apr 13, 2016

readme.md

is-positive Build Status

Check if something is a positive number

Install

$ npm install --save is-positive

Usage

const isPositive = require('is-positive');

isPositive(1);
//=> true

isPositive(0);
//=> false

isPositive(-1);
//=> false

isPositive('1');
//=> false

isPositive(Number(1))
//=> true

Note: This module doesn't consider 0 to be a positive number and doesn't distinguish between -0 and 0. If you want to detect 0, use the positive-zero module.

Related

  • is-negative - Check if something is a negative number

License

MIT © Kevin Martensson