# symbol.prototype.description

> Spec-compliant shim for Symbol.prototype.description proposal.

Latest version **2.0.0** (published 2025-12-11) · MIT license · 0 weekly downloads

> **Native alternative:** Symbol.prototype.description — Use native JavaScript (Node 11.0.0+) (https://developer.mozilla.orgGlobal_Objects/Symbol/description)

## Install

```sh
npm install symbol.prototype.description
pnpm add symbol.prototype.description
yarn add symbol.prototype.description
bun add symbol.prototype.description
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-12-11 |
| First published | 2018-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 7 |
| Unpacked size | 28.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | polyfill, shim, es, shim, ecmascript, symbol, description |

## Links

- npm: https://www.npmjs.com/package/symbol.prototype.description
- Repository: https://github.com/es-shims/Symbol.prototype.description
- Homepage: https://github.com/es-shims/Symbol.prototype.description#readme
- Issues: https://github.com/es-shims/Symbol.prototype.description/issues
- Funding: https://github.com/sponsors/ljharb
- npm.io page: https://npm.io/package/symbol.prototype.description

## Dependencies (7)

- [gopd](https://npm.io/package/gopd.md) ^1.2.0
- [call-bind](https://npm.io/package/call-bind.md) ^1.0.8
- [es-errors](https://npm.io/package/es-errors.md) ^1.3.0
- [has-symbols](https://npm.io/package/has-symbols.md) ^1.1.0
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.1.1
- [get-symbol-description](https://npm.io/package/get-symbol-description.md) ^1.1.0
- [object.getownpropertydescriptors](https://npm.io/package/object.getownpropertydescriptors.md) ^2.1.9

## Recent versions

- 2.0.0 (latest) — 2025-12-11
- 1.0.7 — 2024-12-18
- 1.0.6 — 2024-02-15
- 1.0.5 — 2021-08-17
- 1.0.4 — 2021-02-21
- 1.0.3 — 2020-11-23
- 1.0.2 — 2019-12-14
- 1.0.1 — 2019-10-19
- 1.0.0 — 2018-01-23

## README

# Symbol.prototype.description <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

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 (eg, node >= v11.15.0)

This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES6-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-symbol.prototype.description).

Most common usage:
```js
var description = require('symbol.prototype.description');
var shimDescription = require('symbol.prototype.description/shim');
var assert = require('assert');

assert(description(Symbol('foo')) === 'foo');
assert(description(Symbol()) === undefined);
assert(description(Symbol(undefined)) === undefined);
assert(description(Symbol(null)) === 'null');

if (!('description' in Symbol.prototype)) {
	// note: this should be the empty string, but in many engines,
	// it is impossible to distinguish Symbol() and Symbol('')
	// without globally replacing `Symbol`
	assert(description(Symbol('')) === undefined);

	shimDescription();
}

assert(description(Symbol('foo')) === Symbol('foo').description);
assert(description(Symbol()) === Symbol().description);
assert(description(Symbol(undefined)) === Symbol(undefined).description);
assert(description(Symbol(null)) === Symbol(null).description);

assert(Symbol('').description === ''); // this works fine!
```

## Tests
Simply clone the repo, `npm install`, and run `npm test`

[package-url]: https://npmjs.com/package/symbol.prototype.description
[npm-version-svg]: https://versionbadg.es/es-shims/Symbol.prototype.description.svg
[deps-svg]: https://david-dm.org/es-shims/Symbol.prototype.description.svg
[deps-url]: https://david-dm.org/es-shims/Symbol.prototype.description
[dev-deps-svg]: https://david-dm.org/es-shims/Symbol.prototype.description/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Symbol.prototype.description#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/symbol.prototype.description.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/symbol.prototype.description.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/symbol.prototype.description.svg
[downloads-url]: https://npm-stat.com/charts.html?package=symbol.prototype.description
[codecov-image]: https://codecov.io/gh/es-shims/Symbol.prototype.description/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Symbol.prototype.description/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Symbol.prototype.description
[actions-url]: https://github.com/es-shims/Symbol.prototype.description/actions

---
_Source: https://npm.io/package/symbol.prototype.description · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
