# multi-map **Repository Path**: xxXyh1908/multi-map ## Basic Information - **Project Name**: multi-map - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-10-12 - **Last Updated**: 2021-10-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: multi-map, collection ## README

Welcome to multi-map 👋

Version License: MIT

### 🏠 [Homepage](https://gitee.com/xxXyh1908/multi-map/#readme)

Map which Allow Multiple Values for the same Key

## Getting Started ```js import { MultiMap } from 'multi-map' const map = new MultiMap([['a', 'value a1'], ['a', 'value a2'], ['b', 'value b']]) // 'a' ==> 'value a1', 'value a2' // 'b' ==> 'value b' map.set('a', 'value a3') // 'a' ==> 'value a1', 'value a2', 'value a3' // 'b' ==> 'value b' map.get('a') // readonly ['value a1', 'value a2', 'value a3'] map.size // 2 map.count // 4 map.has('b') // true map.hasValue('a', 'value 4') // false map.delete('a', 'value a1') // 'a' ==> 'value a2', 'value a3' // 'b' ==> 'value b' map.delete('a') // 'b' ==> 'value b' map.clear() // Empty ``` ## types ```ts declare class MultiMap { constructor(entries?: Iterable<(readonly [K, V])> | null, unique?: boolean); get(key: K): Iterable; set(key: K, ...items: V[]): void; has(key: K, ...value: [V]): boolean; delete(key: K, ...value: [V]): boolean; clear(): void; keys(): IterableIterator; values(): IterableIterator; entries(): IterableIterator<[K, V]>; [Symbol.iterator](): IterableIterator<[K, V]>; readonly size: number; readonly count: number; } declare class MultiWeakMap { constructor(entries?: Iterable<(readonly [K, V])> | null, unique?: boolean); get(key: K): Iterable; set(key: K, ...values: V[]): void; has(key: K, ...value: [V]): boolean; delete(key: K, ...value: [V]): boolean; } export { MultiMap, MultiWeakMap }; ``` ## 🤝 Contributing Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://gitee.com/xxXyh1908/multi-map/issues). ## Show your support Give a ⭐️ if this project helped you! *** _This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_