import { Maybe } from "purify-ts"; /** * An extension of the built-in Map type in Javascript with a few additional * useful methods. */ export declare class PureMap extends Map { constructor(entries?: readonly (readonly [K, V])[] | null); /** * Implements `get` but with a `Maybe` return value. I really dislike the use * of `undefined` as a "nothing there" response from `Map` because **you can * store `undefined` in a `Map`** and there is no way (externally) to * distinguish between the case of "that key isn't associated with a value" * and "that key is associated with a value that evaluates to `undefined`" * @param k * @returns */ getMaybe(k: K): Maybe; /** * This method assumes that the key being used does not have a value * associated with it yet. If the key does have a value associated with it, * this method throws. * @param k * @param v * @returns */ setFirst(k: K, v: V, msg?: string): this; /** * This invokes the `set` method but then returns the value that being * assigned to the key rather than returning the map. * @param k * @param v * @returns */ setRet(k: K, v: V): V; /** * This method assumes that the key has a value associated with it. If no * value is associated with the key, this throws. * @param k * @param e An alternative `Error` to be thrown (potentially with a more descriptive error message) * @returns */ mustGet(k: K, e?: Error): V; } /** * An extension of the built-in Map type in Javascript with a few additional * useful methods. */ export declare class PureWeakMap extends WeakMap { constructor(entries?: readonly [K, V][] | null); /** * Implements `get` but with a `Maybe` return value. I really dislike the use * of `undefined` as a "nothing there" response from `Map` because **you can * store `undefined` in a `Map`** and there is no way (externally) to * distinguish between the case of "that key isn't associated with a value" * and "that key is associated with a value that evaluates to `undefined`" * @param k * @returns */ getMaybe(k: K): Maybe; /** * This method assumes that the key being used does not have a value * associated with it yet. If the key does have a value associated with it, * this method throws. * @param k * @param v * @returns */ setFirst(k: K, v: V, msg?: string): this; /** * This invokes the `set` method but then returns the value that being * assigned to the key rather than returning the map. * @param k * @param v * @returns */ setRet(k: K, v: V): V; /** * This method assumes that the key has a value associated with it. If no * value is associated with the key, this throws. * @param k * @param e An alternative `Error` to be thrown (potentially with a more descriptive error message) * @returns */ mustGet(k: K, e?: Error): V; }