UNPKG

minotor

Version:

A lightweight client-side transit routing library.

11 lines (10 loc) 516 B
/** * Returns the value stored under `key`, inserting and returning `defaultValue` * when the key is absent. Mirrors the TC39 `Map.prototype.getOrInsert` * proposal. * * TODO: remove this helper and call `map.getOrInsert(key, defaultValue)` * directly once we only target Node 26+ (where the method is built in). * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/getOrInsert */ export declare const getOrInsert: <K, V>(map: Map<K, V>, key: K, defaultValue: V) => V;