prelude/symbol
API referenceJavaScript's Symbol, a global (std/lang/symbol/index.vlt): unique values compared by identity, which also name members of objects (Symbols). For a walkthrough, read the guide.
Exports
console.log and toString() as Symbol(description)).SymbolConstructorThe static members of Symbol (Symbol.for(key), Symbol.iterator & co.; TypeScript calls the type of Symbol SymbolConstructor too).symbolNo doc comment yetfunction Symbol(description?: string): symbolA new symbol, different from every other one, with an optional description (shown by
console.log and toString() as Symbol(description)). Called in the initializer of a module
constant (const KEY = Symbol("key")), the symbol is made once, as in JavaScript.
The static members of Symbol (Symbol.for(key), Symbol.iterator & co.; TypeScript calls
the type of Symbol SymbolConstructor too).
static readonly asyncDispose: symbol = symbolStatic(0, "Symbol.asyncDispose", true)The method await using calls to dispose of a value.
static readonly asyncIterator: symbol = symbolStatic(1, "Symbol.asyncIterator", true)The method for await calls to get an async iterator.
static readonly dispose: symbol = symbolStatic(2, "Symbol.dispose", true)The method using calls to dispose of a value.
static readonly hasInstance: symbol = symbolStatic(3, "Symbol.hasInstance", true)The method instanceof consults in JavaScript.
static readonly isConcatSpreadable: symbol = symbolStatic(4, "Symbol.isConcatSpreadable", true)Whether Array.prototype.concat flattens an object in JavaScript.
static readonly iterator: symbol = symbolStatic(5, "Symbol.iterator", true)The method for...of calls to get an iterator.
static readonly match: symbol = symbolStatic(6, "Symbol.match", true)The method String.prototype.match calls in JavaScript.
static readonly matchAll: symbol = symbolStatic(7, "Symbol.matchAll", true)The method String.prototype.matchAll calls in JavaScript.
static readonly replace: symbol = symbolStatic(8, "Symbol.replace", true)The method String.prototype.replace calls in JavaScript.
static readonly search: symbol = symbolStatic(9, "Symbol.search", true)The method String.prototype.search calls in JavaScript.
static readonly species: symbol = symbolStatic(10, "Symbol.species", true)The constructor JavaScript uses for derived objects.
static readonly split: symbol = symbolStatic(11, "Symbol.split", true)The method String.prototype.split calls in JavaScript.
static readonly toPrimitive: symbol = symbolStatic(12, "Symbol.toPrimitive", true)The method JavaScript calls to convert an object to a primitive.
static readonly toStringTag: symbol = symbolStatic(13, "Symbol.toStringTag", true)The string Object.prototype.toString shows for an object in JavaScript.
static readonly unscopables: symbol = symbolStatic(14, "Symbol.unscopables", true)The names with statements leave out in JavaScript.
static for(key: string): symbolThe symbol of the global registry for key, made on first use: the same for every call.
static keyFor(sym: symbol): string | undefinedThe key of a symbol Symbol.for made, or undefined for others.
No doc comment yet: add one
get description(): string | undefinedThe description given to Symbol(description), or undefined.
toString(): stringSymbol(description).