Skip to main content

Symbol predicates

Less than 1 minute

Symbol predicatesopen in new window


category: feature tag:

  • es-proposal

---

Modules

Types

interface SymbolConstructor {
  isRegisteredSymbol(value: symbol): boolean;
  isWellKnownSymbol(value: symbol): boolean;
}

Entry points

core-js/proposals/symbol-predicates-v2
core-js(-pure)/full/symbol/is-registered-symbol
core-js(-pure)/full/symbol/is-well-known-symbol

Example

Exampleopen in new window

Symbol.isRegisteredSymbol(Symbol.for("key")); // => true
Symbol.isRegisteredSymbol(Symbol("key")); // => false
Symbol.isWellKnownSymbol(Symbol.iterator); // => true
Symbol.isWellKnownSymbol(Symbol("key")); // => false