@hyperfrontend/immutable-api-utils/built-in-copy/weak-mapweak-map
Locked, prototype-pollution-resistant copy of the global WeakMap constructor.
The WeakMap constructor is wrapped in a createWeakMap factory at module-load time and frozen into a tamper-proof namespace, so private-state storage keeps working even if the global WeakMap is later patched. Effective only when imported before any untrusted code has had a chance to mutate the prototype chain.
API Reference
ƒ Functions
(Safe copy) Creates a new WeakMap using the captured WeakMap constructor. Use this instead of
new WeakMap().Parameters
| Name | Type | Description |
|---|---|---|
§iterable? | Iterable<unknown, any, any> | Optional iterable of key-value pairs. |
Returns
WeakMap<K, V>A new WeakMap instance.
● Variables
(Safe copy) Namespace object containing WeakMap factory. Note: Importing this imports all methods in this namespace (no tree-shaking).