weak-ref-collections
Advanced tools
Comparing version 1.2.3 to 1.2.4
{ | ||
"name": "weak-ref-collections", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "Iterable WeakMaps and WeakSets. Provides WeakRefMap and WeakRefSet which store values using WeakRefs and clean themselves up when garbage collected.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# Weak Ref Collections | ||
Iterable WeakMaps and WeakSets. Provides WeakRefMap and WeakRefSet which store object values using WeakRefs and clean themselves up when garbage collected. Supports both objects and primitives simultaneously. Behaves like normal Map and Set for primitives. | ||
## Installation | ||
```bash | ||
npm install weak-ref-collections | ||
``` | ||
## Usage | ||
Unlike WeakMap which stores keys weakly, WeakRefMap stores keys strongly but stores values using WeakRefs. Is fully iterable. Works just like a normal Map object but holds its values weakly and cleans itself up when its values are garbage collected. Follows the [Map API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) | ||
@@ -39,2 +45,2 @@ | ||
for (const value of weakRefSet.values()) {} | ||
``` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22015
46