3.0.0 • Published 1 year ago

@teppeis/multimaps v3.0.0

Weekly downloads
34,663
License
MIT
Repository
github
Last release
1 year ago

@teppeis/multimaps

Multi-Map classes for TypeScript and JavaScript

npm version Node.js Version Support TypeScript Version Support build status dependency status monthly downloads License

Install

$ npm i @teppeis/multimaps

Usage

ArrayMultimap

import {ArrayMultimap} from '@teppeis/multimaps';

const map = new ArrayMultimap<string, string>();
map.put('foo', 'a');
map.get('foo'); // ['a']
map.put('foo', 'b');
map.get('foo'); // ['a', 'b']
map.put('foo', 'a');
map.get('foo'); // ['a', 'b', 'a']

SetMultimap

import {SetMultimap} from '@teppeis/multimaps';

const map = new SetMultimap<string, string>();
map.put('foo', 'a');
map.get('foo'); // a `Set` of ['a']
map.put('foo', 'b');
map.get('foo'); // a `Set` of ['a', 'b']
map.put('foo', 'a');
map.get('foo'); // a `Set` of ['a', 'b']

License

MIT License: Teppei Sato <teppeis@gmail.com>