|
|
3 years ago | |
|---|---|---|
| .. | ||
| .github | 3 years ago | |
| test | 3 years ago | |
| .eslintignore | 3 years ago | |
| .eslintrc | 3 years ago | |
| .nycrc | 3 years ago | |
| CHANGELOG.md | 3 years ago | |
| LICENSE | 3 years ago | |
| README.md | 3 years ago | |
| getInferredName.js | 3 years ago | |
| index.js | 3 years ago | |
| package.json | 3 years ago | |
Gets the description of a Symbol. Handles Symbol() vs Symbol('') properly when possible.
var getSymbolDescription = require('get-symbol-description');
var assert = require('assert');
assert(getSymbolDescription(Symbol()) === undefined);
assert(getSymbolDescription(Symbol('')) === ''); // or `undefined`, if in an engine that lacks name inference from concise method
assert(getSymbolDescription(Symbol('foo')) === 'foo');
assert(getSymbolDescription(Symbol.iterator) === 'Symbol.iterator');
Simply clone the repo, npm install, and run npm test