https://github.com/harunurhan/bi-directional-map
Yet another bi directional map implementation for JS (in TypeScript)
https://github.com/harunurhan/bi-directional-map
bimap datastructure typescript-library
Last synced: about 1 month ago
JSON representation
Yet another bi directional map implementation for JS (in TypeScript)
- Host: GitHub
- URL: https://github.com/harunurhan/bi-directional-map
- Owner: harunurhan
- Created: 2017-11-08T10:21:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-02T22:59:08.000Z (over 6 years ago)
- Last Synced: 2025-04-12T23:14:00.950Z (about 1 month ago)
- Topics: bimap, datastructure, typescript-library
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## BiDirectionalMap
Simple implementation of bi directional map (`key` <=> `value`) using 2 es6 `Map`s in typescript.
### Install
`npm install bi-directional-map`
### Usage
```typescript
import { BiDirectionalMap } from 'bi-directional-map/dist';const map = new BiDirectionalMap({ a: 'apple', b: 'banana' });
map.set('o', 'orange');
map.deleteKey('b');
map.deleteValue('apple');
map.size // 1
map.hasKey('a') // false
map.hasValue('banana') // false
```Check [tests](./src/index.spec.ts) for more examples.