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.

44 lines
1.4 KiB

4 years ago
  1. #is-symbol <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 an ES6 Symbol value?
  10. ## Example
  11. ```js
  12. var isSymbol = require('is-symbol');
  13. assert(!isSymbol(function () {}));
  14. assert(!isSymbol(null));
  15. assert(!isSymbol(function* () { yield 42; return Infinity; });
  16. assert(isSymbol(Symbol.iterator));
  17. assert(isSymbol(Symbol('foo')));
  18. assert(isSymbol(Symbol.for('foo')));
  19. assert(isSymbol(Object(Symbol('foo'))));
  20. ```
  21. ## Tests
  22. Simply clone the repo, `npm install`, and run `npm test`
  23. [1]: https://npmjs.org/package/is-symbol
  24. [2]: http://versionbadg.es/inspect-js/is-symbol.svg
  25. [3]: https://travis-ci.org/inspect-js/is-symbol.svg
  26. [4]: https://travis-ci.org/inspect-js/is-symbol
  27. [5]: https://david-dm.org/inspect-js/is-symbol.svg
  28. [6]: https://david-dm.org/inspect-js/is-symbol
  29. [7]: https://david-dm.org/inspect-js/is-symbol/dev-status.svg
  30. [8]: https://david-dm.org/inspect-js/is-symbol#info=devDependencies
  31. [11]: https://nodei.co/npm/is-symbol.png?downloads=true&stars=true
  32. [license-image]: http://img.shields.io/npm/l/is-symbol.svg
  33. [license-url]: LICENSE
  34. [downloads-image]: http://img.shields.io/npm/dm/is-symbol.svg
  35. [downloads-url]: http://npm-stat.com/charts.html?package=is-symbol