@woubuc/multimap
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

MultiMap

npm

Wrappers around Map with utility functions for maps containing arrays or sets of items for each key.

Usage

Install the package into your dependencies

pnpm add @woubuc/multimap

Use the map

import { ArrayMap, SetMap } from '@woubuc/multimap';

let arrays = new ArrayMap();
arrays.set('foo', [1]); // foo: [1]
arrays.push('foo', 2); // foo: [1, 2]
arrays.delete('foo'); // foo: undefined
arrays.push('foo', 3); // foo: [3]

let sets = new SetMap();
sets.add('foo', 1); // foo: Set(1)
sets.add('foo', 1); // foo: Set(1)
sets.add('foo', 2); // foo: Set(1, 2)

View the full API docs

License

MIT license

Package Sidebar

Install

npm i @woubuc/multimap

Weekly Downloads

1

Version

2.1.0

License

MIT

Unpacked Size

23.2 kB

Total Files

15

Last publish

Collaborators

  • woubuc