caoge c760052ff9 机车状态修改 | hai 8 meses | |
---|---|---|
.. | ||
.github | hai 8 meses | |
test | hai 8 meses | |
.editorconfig | hai 8 meses | |
.eslintrc | hai 8 meses | |
.nycrc | hai 8 meses | |
CHANGELOG.md | hai 8 meses | |
LICENSE | hai 8 meses | |
README.md | hai 8 meses | |
index.js | hai 8 meses | |
package.json | hai 8 meses |
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