[d565449] | 1 | # get-symbol-description <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 | Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.
|
---|
| 13 |
|
---|
| 14 | ## Example
|
---|
| 15 |
|
---|
| 16 | ```js
|
---|
| 17 | var getSymbolDescription = require('get-symbol-description');
|
---|
| 18 | var assert = require('assert');
|
---|
| 19 |
|
---|
| 20 | assert(getSymbolDescription(Symbol()) === undefined);
|
---|
| 21 | assert(getSymbolDescription(Symbol('')) === ''); // or `undefined`, if in an engine that lacks name inference from concise method
|
---|
| 22 | assert(getSymbolDescription(Symbol('foo')) === 'foo');
|
---|
| 23 | assert(getSymbolDescription(Symbol.iterator) === 'Symbol.iterator');
|
---|
| 24 | ```
|
---|
| 25 |
|
---|
| 26 | ## Tests
|
---|
| 27 | Simply clone the repo, `npm install`, and run `npm test`
|
---|
| 28 |
|
---|
| 29 | [1]: https://npmjs.org/package/get-symbol-description
|
---|
| 30 | [2]: https://versionbadg.es/inspect-js/get-symbol-description.svg
|
---|
| 31 | [5]: https://david-dm.org/inspect-js/get-symbol-description.svg
|
---|
| 32 | [6]: https://david-dm.org/inspect-js/get-symbol-description
|
---|
| 33 | [7]: https://david-dm.org/inspect-js/get-symbol-description/dev-status.svg
|
---|
| 34 | [8]: https://david-dm.org/inspect-js/get-symbol-description#info=devDependencies
|
---|
| 35 | [11]: https://nodei.co/npm/get-symbol-description.png?downloads=true&stars=true
|
---|
| 36 | [license-image]: https://img.shields.io/npm/l/get-symbol-description.svg
|
---|
| 37 | [license-url]: LICENSE
|
---|
| 38 | [downloads-image]: https://img.shields.io/npm/dm/get-symbol-description.svg
|
---|
| 39 | [downloads-url]: https://npm-stat.com/charts.html?package=get-symbol-description
|
---|
| 40 | [codecov-image]: https://codecov.io/gh/inspect-js/get-symbol-description/branch/main/graphs/badge.svg
|
---|
| 41 | [codecov-url]: https://app.codecov.io/gh/inspect-js/get-symbol-description/
|
---|
| 42 | [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/get-symbol-description
|
---|
| 43 | [actions-url]: https://github.com/inspect-js/get-symbol-description/actions
|
---|