import { Box } from "./box"; import { DefaultOrFunc } from "./fn"; import { Option } from "./option"; import { MapKey, MutableMapLike, MapValue, MapLike } from "./types"; /** Extended Map */ export declare function MapEx>(map: M): ExMap; /** Mutable Extended Map */ export declare function MutMapEx>(map: M): MutableExMap; /** Extended Map */ export declare class ExMap> implements Box, MapLike, MapValue> { val: M; constructor(val: M); get(key: MapKey): MapValue | undefined; has(key: MapKey): boolean; /** If it does not exist, return to the default value */ getOrDefault(key: MapKey, defv: DefaultOrFunc>): MapValue; /** Get and pass to the callback */ getAndThen(key: MapKey, then: (val: MapValue) => any): void; /** Get as Promise*/ getAndThen(key: MapKey): Promise>; /** Try to get * Option instead of Maybe to ensure that the value of None can be distinguished */ tryGet(key: MapKey): Option>; } /** Mutable Extended Map */ export declare class MutableExMap> extends ExMap implements MutableMapLike, MapValue> { constructor(val: M); set(key: MapKey, value: MapValue): this; delete(key: MapKey): boolean; /** Get if has, add if not */ getOrAdd(key: MapKey, init: () => MapValue): MapValue; }