{"id":15048069,"url":"https://github.com/github/multimap","last_synced_at":"2025-08-02T09:38:50.990Z","repository":{"id":37541442,"uuid":"265969140","full_name":"github/multimap","owner":"github","description":"A map in which more than one value may be stored under each key.","archived":false,"fork":false,"pushed_at":"2025-02-19T23:23:02.000Z","size":436,"stargazers_count":38,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-20T07:07:26.863Z","etag":null,"topics":["keep","multimap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-21T22:59:22.000Z","updated_at":"2025-04-25T00:09:46.000Z","dependencies_parsed_at":"2024-06-18T22:34:48.708Z","dependency_job_id":"29170492-0891-484f-a874-4d4479b72e16","html_url":"https://github.com/github/multimap","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":0.5416666666666667,"last_synced_commit":"63f70c669be11db43ec4706175c09a7555f4ae5e"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/github/multimap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmultimap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmultimap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmultimap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmultimap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/multimap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fmultimap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266900279,"owners_count":24003238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keep","multimap"],"created_at":"2024-09-24T21:07:40.736Z","updated_at":"2025-08-02T09:38:50.962Z","avatar_url":"https://github.com/github.png","language":"JavaScript","readme":"# MultiMap\n\nThe [multimap][1] data structure is a map in which more than one value may be stored under each key.\n\n[1]: https://en.wikipedia.org/wiki/Multimap\n\n## Installation\n\n```\n$ npm install @github/multimap\n```\n\n## Usage\n\n```js\nimport MultiMap from '@github/multimap'\n```\n\n```ts\nconst map = new MultiMap\u003cstring, number\u003e()\nmap.set('a', 1)\nmap.set('a', 2)\nmap.get('a') // =\u003e Set([1, 2])\nmap.has('a') // =\u003e true\nmap.size // =\u003e 1\n```\n\n### Constructors\n\n- `MultiMap()` - Create an empty map.\n- `MultiMap(iterable)` - Create a map with values from an iterable yielding key value pairs: `new MultiMap([['k', 1], ['k', 2]])`\n\n### Methods\n\n- `get(key)` - Retrieve the Set of values stored under a key or the empty Set if the key does not exist.\n- `set(key, value)` - Add a value to the key's set without removing previous values. Returns the map so `set` can be chained.\n- `has(key)` - Returns true if a value is stored under the key.\n- `delete(key)` - Remove key and all of key's values. Returns true if the key existed.\n- `delete(key, value)` - Remove a value from the key's set. Returns true if the key and value existed.\n- `drain(value)` - Remove a value from all keys that reference it. Returns an array of keys removed.\n- `clear()` - Remove all keys and values to empty the map.\n- `keys()` - An iterator of map keys.\n- `values()` - An iterator of Sets of values for all keys.\n- `entries()` - An iterator of [key, Set\u003cvalue\u003e] pairs.\n\n### Properties\n\n- `size` - The number of keys in the map.\n\n## Development\n\n```\nnpm install\nnpm test\n```\n\n## License\n\nDistributed under the MIT license. See LICENSE for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fmultimap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fmultimap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fmultimap/lists"}