@yume-chan/multi-map
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @yume-chan/multi-map

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

15.3 kB

Total Files

9

Last publish

Collaborators

  • yume-chan