@hyperfrontend/immutable-api-utils/built-in-copy/symbol

symbol

Locked, prototype-pollution-resistant copy of the global Symbol factory and well-known symbols.

The Symbol constructor is wrapped in a createSymbol factory and the well-known symbols (iterator, asyncIterator, toStringTag, hasInstance, match, replace, etc.) plus Symbol.for and Symbol.keyFor are captured at module-load time and frozen into a tamper-proof namespace, so symbol-keyed protocols stay trustworthy even if the global Symbol is later patched. Effective only when imported before any untrusted code has had a chance to mutate the prototype chain.

API Reference

ƒ Functions

§function

createSymbol(description?: string | number): symbol

(Safe copy) Creates a new Symbol with optional description. Use this instead of Symbol().

Parameters

NameTypeDescription
§description?
string | number
Optional description for the symbol.

Returns

symbol
A new Symbol.

Variables

§type

Symbol

(Safe copy) Namespace object containing Symbol utilities and well-known symbols. Note: Importing this imports all symbols in this namespace (no tree-shaking).
§type

symbolAsyncIterator

(Safe copy) A method that returns the default async iterator for an object.
§type

symbolFor

(Safe copy) Returns a Symbol object from the global symbol registry.
§type

symbolHasInstance

(Safe copy) A method that determines if a constructor object recognizes an object as its instance.
§type

symbolIsConcatSpreadable

(Safe copy) A Boolean value indicating if an object should be flattened to its array elements.
§type

symbolIterator

(Safe copy) A method that returns the default iterator for an object.
§type

symbolKeyFor

(Safe copy) Returns a key from the global symbol registry.
§type

symbolMatch

(Safe copy) A method that matches against a string.
§type

symbolMatchAll

(Safe copy) A method that returns an index within a string that matches the regular expression.
§type

symbolReplace

(Safe copy) A method that replaces matched substrings of a string.
§type

symbolSearch

(Safe copy) A method that returns the index within a string that matches the regular expression.
§type

symbolSpecies

(Safe copy) A function valued property that is the constructor function that is used to create derived objects.
§type

symbolSplit

(Safe copy) A method that splits a string at the indices that match a regular expression.
§type

symbolToPrimitive

(Safe copy) A method that converts an object to a primitive value.
§type

symbolToStringTag

(Safe copy) A method that converts an object to a primitive value.
§type

symbolUnscopables

(Safe copy) An Object whose own property names are property names that are excluded from the with environment bindings.