@yume-chan/multi-map
v1.0.2
Published
A single key multiple values map
Downloads
3,097
Readme
MultiMap
A single key multiple values map
Install
npm i @yume-chan/multi-map
API
export interface ReadonlyMultiMap<TKey, TValue> {
keys(): Iterable<TKey>;
get(key: TKey): Iterable<TValue>;
}
export default class MultiMap<TKey, TValue> implements ReadonlyMultiMap<TKey, TValue> {
add(key: TKey, value: TValue): void;
get(key: TKey): Iterable<TValue>;
size(key: TKey): number;
keys(): Iterable<TKey>;
has(key: TKey): boolean;
has(key: TKey, value: TValue): boolean;
delete(key: TKey): boolean;
delete(key: TKey, value: TValue): boolean;
}
Development
This project uses pnpm (GitHub) to manage dependency packages.
Install dependencies:
pnpm i
You may also use npm
, but the lockfile may become out of sync.
Testing
npm test
Coverage
npm run coverage
License
MIT