1.0.3 • Published 6 years ago

counter-map v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

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');