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

set

Locked, prototype-pollution-resistant copy of the global Set constructor.

The Set constructor is wrapped in a createSet factory at module-load time and frozen into a tamper-proof namespace, so unique-value collection construction keeps working even if the global Set is later patched. Effective only when imported before any untrusted code has had a chance to mutate the prototype chain.

API Reference

ƒ Functions

§function

createSet<T>(iterable?: Iterable<T, any, any>): Set<T>

(Safe copy) Creates a new Set using the captured Set constructor. Use this instead of new Set().

Parameters

NameTypeDescription
§iterable?
Iterable<T, any, any>
Optional iterable of values.

Returns

Set<T>
A new Set instance.

Variables

§type

Set

(Safe copy) Namespace object containing Set factory. Note: Importing this imports all methods in this namespace (no tree-shaking).