@tannerntannern/budgeteer
Version:
A specialized constraint solver for budget flows
26 lines (25 loc) • 788 B
TypeScript
/**
* A Map with two keys as opposed to one. Order does matter, so `map.get(k1, k2) !== map.get(k2, k1)` for example.
*/
export declare class TwoKeyMap<K, V> {
/**
* Internal storage for the TwoKeyMap, which is just a Map of Maps.
*/
private values;
/**
* Creates a relationship between `[k1, k2]` and `v`, overwriting if one already exists.
*/
set(k1: K, k2: K, val: V): void;
/**
* Gets the value associated with `[k1, k2]`.
*/
get(k1: K, k2: K): V;
/**
* Similar to JavaScript's `Map.prototype.forEach`, but with slightly different arguments.
*/
forEach(handler: (k1: K, k2: K, val: V) => void): void;
/**
* Clears all entries from the TwoKeyMap.
*/
clear(): void;
}