peach a19a732be8 commit message | vor 2 Jahren | |
---|---|---|
.. | ||
.github | vor 2 Jahren | |
test | vor 2 Jahren | |
.editorconfig | vor 2 Jahren | |
.eslintrc | vor 2 Jahren | |
.nycrc | vor 2 Jahren | |
CHANGELOG.md | vor 2 Jahren | |
LICENSE | vor 2 Jahren | |
README.md | vor 2 Jahren | |
index.js | vor 2 Jahren | |
package.json | vor 2 Jahren |
Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
var isNumber = require('is-number-object');
var assert = require('assert');
assert.notOk(isNumber(undefined));
assert.notOk(isNumber(null));
assert.notOk(isNumber(false));
assert.notOk(isNumber(true));
assert.notOk(isNumber('foo'));
assert.notOk(isNumber(function () {}));
assert.notOk(isNumber([]));
assert.notOk(isNumber({}));
assert.notOk(isNumber(/a/g));
assert.notOk(isNumber(new RegExp('a', 'g')));
assert.notOk(isNumber(new Date()));
assert.ok(isNumber(42));
assert.ok(isNumber(NaN));
assert.ok(isNumber(Infinity));
assert.ok(isNumber(new Number(42)));
Simply clone the repo, npm install
, and run npm test