{"id":23236747,"url":"https://github.com/pratikpc/ts-bidirectional-map","last_synced_at":"2025-04-05T21:17:25.430Z","repository":{"id":57380529,"uuid":"281196492","full_name":"pratikpc/ts-bidirectional-map","owner":"pratikpc","description":"A BiDirectional Map Created In TypeScript","archived":false,"fork":false,"pushed_at":"2020-07-20T18:38:22.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T00:38:44.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pratikpc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-20T18:32:04.000Z","updated_at":"2020-07-20T18:38:25.000Z","dependencies_parsed_at":"2022-08-28T22:01:57.504Z","dependency_job_id":null,"html_url":"https://github.com/pratikpc/ts-bidirectional-map","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fts-bidirectional-map","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fts-bidirectional-map/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fts-bidirectional-map/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratikpc%2Fts-bidirectional-map/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratikpc","download_url":"https://codeload.github.com/pratikpc/ts-bidirectional-map/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399897,"owners_count":20932881,"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":[],"created_at":"2024-12-19T04:12:37.520Z","updated_at":"2025-04-05T21:17:25.409Z","avatar_url":"https://github.com/pratikpc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript Bidirectional Map\n\nA TypeScript Version of [@educastellano](https://github.com/educastellano)'s [BiDirectional Map](https://github.com/educastellano/bidirectional-map)\n\nCreate \"key/value\" collections of one-to-one correspondence. Internally it uses two [Map](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) objects, so both keys and values can be of any type.\n\n# Install\n\n    npm install ts-bidirectional-map --save\n\n# Usage\n\n```ts\n    import BiMap from 'ts-bidirectional-map';\n    \n    // Create an empty map\n    const map = new BiMap\u003cString, String\u003e();\n    map.set('bob', 'alice');\n    map.get('bob');          // 'alice'\n    map.getKey('alice');     // 'bob'\n\n    map2.has('bob');          // true\n    map2.hasValue('alice');   // true\n    map2.deleteValue('alice');\n```\n\n# API\n\n### Properties\n\n| Property | Return Type |  Description |\n|:---|:---|:---|\n| size | *any* | Returns the number of key/value pairs |\n\n### Methods\n\n| Method | Arguments | Return Type |  Description |\n|:---|:---|:---|:---|\n| set | key: *K*, value: *V*  |  | Sets a new key/value pair |\n| get | key: *K* | *V* | Returns the value |\n| getKey | value: *V* | *K* | Returns the key |\n| clear |  |  | Removes all key/value pairs |\n| delete | key: *K* | | Deletes a key/value pair by **key** |\n| deleteValue | value: *V* | | Deletes a key/value pair by **value** |\n| entries |  | *MapIterator* | Returns a new Iterator object that contains an array of [key, value] for each element in the structure |\n| has | key: *K* | *boolean*| Returns a *true* if it exists a pair with the provided **key**, *false* otherwise  |\n| hasValue | value: *V* | *boolean* | Returns a *true* if it exists a pair with the provided **value**, *false* otherwise  |\n| keys |  | *MapIterator* | Returns a new Iterator object that contains the **keys** for each element in the structure |\n| values |  | *MapIterator* | Returns a new Iterator object that contains the **values** for each element in the structure |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikpc%2Fts-bidirectional-map","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratikpc%2Fts-bidirectional-map","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratikpc%2Fts-bidirectional-map/lists"}