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

weak-set

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

The WeakSet constructor is wrapped in a createWeakSet factory at module-load time and frozen into a tamper-proof namespace, so weakly-held membership tracking keeps working even if the global WeakSet is later patched. Effective only when imported before any untrusted code has had a chance to mutate the prototype chain.

API Reference

ƒ Functions

§function

createWeakSet<T>(iterable?: Iterable<T, any, any>): WeakSet<T>

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

Parameters

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

Returns

WeakSet<T>
A new WeakSet instance.

Variables

§type

WeakSet

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