Name: Symbol.prototype.description
Owner: ECMAScript Shims
Description: Spec-compliant shim for Symbol.prototype.description proposal.
Created: 2017-07-25 18:42:05.0
Updated: 2017-07-28 16:36:00.0
Pushed: 2018-01-23 22:06:32.0
Homepage: null
Size: 19
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
An ECMAScript spec-compliant Symbol.prototype.description
shim. Invoke its “shim” method to shim Symbol.prototype.description if it is unavailable.
Note: Symbol#description
requires a true ES6 environment, specifically one with native Symbols.
This package implements the es-shim API interface. It works in an ES6-supported environment and complies with the spec.
Most common usage:
description = require('symbol.prototype.description');
rt(description(Symbol('foo')) === 'foo');
rt(description(Symbol()) === undefined);
rt(description(Symbol(undefined)) === undefined);
rt(description(Symbol(null)) === 'null');
ote: this should be the empty string, but in many engines,
t is impossible to distinguish Symbol() and Symbol('')
ithout globally replacing `Symbol`
rt(description(Symbol('')) === undefined);
!Symbol.prototype.description) {
description.shim();
rt(description(Symbol('foo')) === Symbol('foo').description);
rt(description(Symbol()) === Symbol().description);
rt(description(Symbol(undefined)) === Symbol(undefined).description);
rt(description(Symbol(null)) === Symbol(null).description);
rt(Symbol('').description === ''); // this works fine!
Simply clone the repo, npm install
, and run npm test