Skip to content

devsnek/weak-value-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeakValueMap

A map where the values are weak.

import WeakValueMap from '@snek/wvm';

const map = new WeakValueMap();
map.set('some key', someBigObject);

new WeakValueMap([iterable [, options]])

  • iterable An Array or other iterable object whose elements are key-value pairs (arrays with two elements, e.g. [[ 1, { a: 1 } ], [ 2, { a: 2 } ]]). Each key-value pair is added to the new Map; null values are treated as undefined.
  • options
    • eager A boolean option indicating whether collected items should be eagerly tracked and removed from the map. If you have concerns about GC pressure, you may want to consider disabling this option. Default: true.

About

The WeakValueMap you deserve

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published