5b8aa8175ed27e1e414f910470f1748f25aa0cae1831c1498cf9c4badd519b1bc7b91ef22083ceac34889acbdd926c60ba6c0d34531b6a633f71f3ba4d0e83 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # is-negative-zero <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
  2. [![github actions][actions-image]][actions-url]
  3. [![coverage][codecov-image]][codecov-url]
  4. [![dependency status][deps-svg]][deps-url]
  5. [![dev dependency status][dev-deps-svg]][dev-deps-url]
  6. [![License][license-image]][license-url]
  7. [![Downloads][downloads-image]][downloads-url]
  8. [![npm badge][npm-badge-png]][package-url]
  9. Is this value negative zero? === will lie to you.
  10. ## Example
  11. ```js
  12. var isNegativeZero = require('is-negative-zero');
  13. var assert = require('assert');
  14. assert.notOk(isNegativeZero(undefined));
  15. assert.notOk(isNegativeZero(null));
  16. assert.notOk(isNegativeZero(false));
  17. assert.notOk(isNegativeZero(true));
  18. assert.notOk(isNegativeZero(0));
  19. assert.notOk(isNegativeZero(42));
  20. assert.notOk(isNegativeZero(Infinity));
  21. assert.notOk(isNegativeZero(-Infinity));
  22. assert.notOk(isNegativeZero(NaN));
  23. assert.notOk(isNegativeZero('foo'));
  24. assert.notOk(isNegativeZero(function () {}));
  25. assert.notOk(isNegativeZero([]));
  26. assert.notOk(isNegativeZero({}));
  27. assert.ok(isNegativeZero(-0));
  28. ```
  29. ## Tests
  30. Simply clone the repo, `npm install`, and run `npm test`
  31. [package-url]: https://npmjs.org/package/is-negative-zero
  32. [npm-version-svg]: https://versionbadg.es/inspect-js/is-negative-zero.svg
  33. [deps-svg]: https://david-dm.org/inspect-js/is-negative-zero.svg
  34. [deps-url]: https://david-dm.org/inspect-js/is-negative-zero
  35. [dev-deps-svg]: https://david-dm.org/inspect-js/is-negative-zero/dev-status.svg
  36. [dev-deps-url]: https://david-dm.org/inspect-js/is-negative-zero#info=devDependencies
  37. [npm-badge-png]: https://nodei.co/npm/is-negative-zero.png?downloads=true&stars=true
  38. [license-image]: https://img.shields.io/npm/l/is-negative-zero.svg
  39. [license-url]: LICENSE
  40. [downloads-image]: https://img.shields.io/npm/dm/is-negative-zero.svg
  41. [downloads-url]: https://npm-stat.com/charts.html?package=is-negative-zero
  42. [codecov-image]: https://codecov.io/gh/inspect-js/is-negative-zero/branch/main/graphs/badge.svg
  43. [codecov-url]: https://app.codecov.io/gh/inspect-js/is-negative-zero/
  44. [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-negative-zero
  45. [actions-url]: https://github.com/inspect-js/is-negative-zero/actions