1 | # is-number-object <sup>[![Version Badge][2]][1]</sup>
|
---|
2 |
|
---|
3 | [![github actions][actions-image]][actions-url]
|
---|
4 | [![coverage][codecov-image]][codecov-url]
|
---|
5 | [![dependency status][5]][6]
|
---|
6 | [![dev dependency status][7]][8]
|
---|
7 | [![License][license-image]][license-url]
|
---|
8 | [![Downloads][downloads-image]][downloads-url]
|
---|
9 |
|
---|
10 | [![npm badge][11]][1]
|
---|
11 |
|
---|
12 | Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
|
---|
13 |
|
---|
14 | ## Example
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | var isNumber = require('is-number-object');
|
---|
18 | var assert = require('assert');
|
---|
19 |
|
---|
20 | assert.notOk(isNumber(undefined));
|
---|
21 | assert.notOk(isNumber(null));
|
---|
22 | assert.notOk(isNumber(false));
|
---|
23 | assert.notOk(isNumber(true));
|
---|
24 | assert.notOk(isNumber('foo'));
|
---|
25 | assert.notOk(isNumber(function () {}));
|
---|
26 | assert.notOk(isNumber([]));
|
---|
27 | assert.notOk(isNumber({}));
|
---|
28 | assert.notOk(isNumber(/a/g));
|
---|
29 | assert.notOk(isNumber(new RegExp('a', 'g')));
|
---|
30 | assert.notOk(isNumber(new Date()));
|
---|
31 |
|
---|
32 | assert.ok(isNumber(42));
|
---|
33 | assert.ok(isNumber(NaN));
|
---|
34 | assert.ok(isNumber(Infinity));
|
---|
35 | assert.ok(isNumber(new Number(42)));
|
---|
36 | ```
|
---|
37 |
|
---|
38 | ## Tests
|
---|
39 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
40 |
|
---|
41 | [1]: https://npmjs.org/package/is-number-object
|
---|
42 | [2]: https://versionbadg.es/inspect-js/is-number-object.svg
|
---|
43 | [5]: https://david-dm.org/inspect-js/is-number-object.svg
|
---|
44 | [6]: https://david-dm.org/inspect-js/is-number-object
|
---|
45 | [7]: https://david-dm.org/inspect-js/is-number-object/dev-status.svg
|
---|
46 | [8]: https://david-dm.org/inspect-js/is-number-object#info=devDependencies
|
---|
47 | [11]: https://nodei.co/npm/is-number-object.png?downloads=true&stars=true
|
---|
48 | [license-image]: https://img.shields.io/npm/l/is-number-object.svg
|
---|
49 | [license-url]: LICENSE
|
---|
50 | [downloads-image]: https://img.shields.io/npm/dm/is-number-object.svg
|
---|
51 | [downloads-url]: https://npm-stat.com/charts.html?package=is-number-object
|
---|
52 | [codecov-image]: https://codecov.io/gh/inspect-js/is-number-object/branch/main/graphs/badge.svg
|
---|
53 | [codecov-url]: https://app.codecov.io/gh/inspect-js/is-number-object/
|
---|
54 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-number-object
|
---|
55 | [actions-url]: https://github.com/inspect-js/is-number-object/actions
|
---|