counter-map
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i counter-map

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

1.28 MB

Total Files

28

Last publish

Collaborators

  • yonia