es-shims/Symbol.prototype.description

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Symbol.prototype.description Version Badge

Build Status dependency status dev dependency status License Downloads

npm badge

browser support

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!
Tests

Simply clone the repo, npm install, and run npm test


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.