Package Exports
- @a11d/bidirectional-map
- @a11d/bidirectional-map/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@a11d/bidirectional-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@a11d/bidirectional-map
A Map implementation that maintains a bidirectional relationship between keys and values, allowing lookups in both directions.
import '@a11d/bidirectional-map'
const map = new BidirectionalMap([
['en', 'English'],
['fr', 'French'],
])
map.get('en') // 'English'
map.getKey('English') // 'en'Installation
npm install @a11d/bidirectional-mapAPI
Implements the standard Map<K, V> interface with additional methods:
getKey(value: V): K | undefined — Get key by value (reverse lookup)
const map = new BidirectionalMap([['en', 'English'], ['fr', 'French']])
map.getKey('English') // 'en'
map.getKey('Spanish') // undefinedhasValue(value: V): boolean — Check if a value exists
const map = new BidirectionalMap([['en', 'English']])
map.hasValue('English') // true
map.hasValue('French') // falsedeleteValue(value: V): boolean — Remove entry by value
const map = new BidirectionalMap([['en', 'English']])
map.deleteValue('English') // true
map.has('en') // falseGlobal Type
The package automatically registers itself globally, so TypeScript recognizes BidirectionalMap without explicit imports:
// Type is available globally
const map: BidirectionalMap<string, number> = new BidirectionalMap()