Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/collections/index.js>BiMap

A JavaScript extension package for building strong and modern applications.
Latest
class BiMap
extends Map
import { BiMap } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/collections/index.js";

Bi-directional map, keys and values are unique and map to each other.

Examples

Example 1

import { BiMap } from "@ayonli/jsext/collections";

const map = new BiMap<string, string>();

map.set("foo", "hello");
map.set("bar", "world");

console.log(map.get("foo")); // hello
console.log(map.getKey("world")); // bar

map.delete("foo");
console.log(map.hasValue("hello")); // false

map.deleteValue("world");
console.log(map.has("bar")); // false

Constructors

new
BiMap(iterable?)

Properties

readonly
[Symbol.toStringTag]

Methods

getKey(value)
hasValue(value)
set(key, value)