web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

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