{"id":26704946,"url":"https://github.com/leawind/bimap-ts","last_synced_at":"2026-04-30T00:33:14.000Z","repository":{"id":284476299,"uuid":"955069731","full_name":"Leawind/bimap-ts","owner":"Leawind","description":"A TypeScript library provides a bi-directional map (BiMap) implementation","archived":false,"fork":false,"pushed_at":"2025-03-26T04:19:00.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T05:19:58.304Z","etag":null,"topics":["bimap","deno","jsr","lib","typescript"],"latest_commit_sha":null,"homepage":"https://jsr.io/@leawind/bimap","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Leawind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-26T04:03:24.000Z","updated_at":"2025-03-26T04:22:36.000Z","dependencies_parsed_at":"2025-03-26T05:30:04.250Z","dependency_job_id":null,"html_url":"https://github.com/Leawind/bimap-ts","commit_stats":null,"previous_names":["leawind/bimap-ts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leawind%2Fbimap-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leawind%2Fbimap-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leawind%2Fbimap-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leawind%2Fbimap-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Leawind","download_url":"https://codeload.github.com/Leawind/bimap-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245786002,"owners_count":20671668,"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","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":["bimap","deno","jsr","lib","typescript"],"created_at":"2025-03-27T05:19:38.879Z","updated_at":"2026-04-30T00:33:13.971Z","avatar_url":"https://github.com/Leawind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BiMap\n\nA TypeScript library provides a bi-directional map (BiMap) implementation, allowing efficient lookups by both keys and values. This library ensures that both keys and values are unique, maintaining an inverse mapping from values to keys.\n\n## Features\n\n- Efficient lookup by both keys and values.\n- Unique keys and values.\n- Methods for adding, deleting, and retrieving key-value pairs.\n- Iterators for keys, values, and entries.\n\n## Usage\n\n### Import\n\n```typescript\nimport { BiMap } from '@leawind/bimap';\n```\n\n### Create a BiMap\n\nYou can create a BiMap using various input types:\n\n```typescript\nconst bimap1: BiMap\u003cstring, number\u003e = BiMap.from(\n\tnew Map([['one', 1], ['two', 2]]),\n);\nconst bimap2: BiMap\u003cstring, number\u003e = BiMap.from([['one', 1], ['two', 2]]);\nconst bimap3: BiMap\u003cstring, number\u003e = BiMap.from({ one: 1, two: 2 });\n```\n\n### Add Key-Value Pairs\n\n```typescript\nconst bimap = new BiMap\u003cstring, number\u003e();\nbimap.set('one', 1);\nbimap.set('two', 2);\n```\n\n### Retrieve Values and Keys\n\n```typescript\nconst value: number = bimap.getValue('one'); // 1\nconst key: string = bimap.getKey(2); // 'two'\n```\n\n### Delete Key-Value Pairs\n\n```typescript\nbimap.deleteKey('one');\nbimap.deleteValue(2);\n```\n\n### Iterate Over Keys, Values, and Entries\n\n```typescript\nfor (const key of bimap.keys()) {\n\tconsole.log(key);\n}\n\nfor (const value of bimap.values()) {\n\tconsole.log(value);\n}\n\nfor (const [key, value] of bimap.entries()) {\n\tconsole.log(key, value);\n}\n```\n\n### Clone a BiMap\n\n```typescript\nconst clone = bimap.clone();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleawind%2Fbimap-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleawind%2Fbimap-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleawind%2Fbimap-ts/lists"}