|
|
il y a 3 ans | |
|---|---|---|
| .. | ||
| .github | il y a 3 ans | |
| test | il y a 3 ans | |
| .eslintignore | il y a 3 ans | |
| .eslintrc | il y a 3 ans | |
| .nycrc | il y a 3 ans | |
| CHANGELOG.md | il y a 3 ans | |
| LICENSE | il y a 3 ans | |
| README.md | il y a 3 ans | |
| getInferredName.js | il y a 3 ans | |
| index.js | il y a 3 ans | |
| package.json | il y a 3 ans | |
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