npm.io
1.0.3 • Published 7 years ago

counter-map

Licence
ISC
Version
1.0.3
Deps
0
Size
1.2 MB
Vulns
0
Weekly
0

Counting Map

A basic map that keeps count of each unique item you set and cleans up only when all counters have been deleted.

Examples:

 const counter = new CountingMap();
 counter.set('key', 'value');

Adding and removing:

    counter.set('key', 'value');
    counter.set('key', 'value');
    counter.delete('key');

This example will keep one instance of key in the map If we run another delete:

    counter.delete('key');

no items with key 'key' are in the map

Only updating with no incrementing:

    const counter = new CountingMap();
    counter.set('key', 'value');
    counter.update('key', 'value1');

Keywords