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