gossamer/symbol_extra

Extras for gleam/javascript/symbol — no-description constructor and registry-key lookup not exposed upstream.

Values

pub fn anonymous() -> symbol.Symbol

Creates a symbol with no description. Distinct from symbol.new(""), which sets the description to the empty string. Equivalent to JavaScript’s Symbol() (called with no argument).

Examples

let s = symbol_extra.anonymous()
symbol.description(s)
// -> Error(Nil)
pub fn key_for(symbol: symbol.Symbol) -> Result(String, Nil)

The registry key for a global symbol. Returns an error if symbol is not in the global registry.

Examples

let s = symbol.get_or_create_global("my.key")
symbol_extra.key_for(s)
// -> Ok("my.key")
Search Document