Configurable hash map implementation w/ ES6 Map API. Uses open addressing / linear probing to resolve key collisions. Supports any key types via mandatory user supplied hash function.
See HashMapOpts for further configuration & behavior details.
The key & value args given the callback fn MUST be treated as readonly/immutable. This could be enforced via TS, but would break ES6 Map interface contract.
Configurable hash map implementation w/ ES6 Map API. Uses open addressing / linear probing to resolve key collisions. Supports any key types via mandatory user supplied hash function.
See HashMapOpts for further configuration & behavior details.
import { HashMap } from "@thi.ng/associative" import { hash } from "@thi.ng/vectors" m = new HashMap([], { hash }) m.set([1, 2], "a"); m.set([3, 4], "b"); m.set([1, 2], "c"); // HashMap { [ 1, 2 ] => 'c', [ 3, 4 ] => 'b' }