//#region src/Map/findMapOrElse.d.ts /** * # findMapOrElse * * ```ts * function Map.findMapOrElse( * target: ReadonlyMap, * predicate: ( * value: NoInfer, * key: NoInfer, * target: ReadonlyMap, * ) => boolean, * mapper: ( * value: NoInfer, * key: NoInfer, * target: ReadonlyMap, * ) => V, * orElse: (target: ReadonlyMap) => O, * ): ReadonlyMap | O * ``` * * Finds the first entry in the map that satisfies the provided `predicate` function and applies the `mapper` function to it, returning a new map with the mapped value, or the result of calling `orElse` with the map if no entry is found. * * ## Example * * ```ts [data-first] * import { Map } from "@monstermann/map"; * * Map.findMapOrElse( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * (value) => value > 10, * (value) => value * 10, * (map) => map.size, * ); // 3 * ``` * * ```ts [data-last] * import { Map } from "@monstermann/map"; * * pipe( * new Map([ * ["a", 1], * ["b", 2], * ["c", 3], * ]), * Map.findMapOrElse( * (value) => value > 10, * (value) => value * 10, * (map) => map.size, * ), * ); // 3 * ``` * */ declare const findMapOrElse: { (predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => value is U, mapper: (value: U, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): (target: Map) => Map | O; (predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => value is U, mapper: (value: U, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): (target: ReadonlyMap) => ReadonlyMap | O; (predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => boolean, mapper: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): (target: Map) => Map | O; (predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => boolean, mapper: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): (target: ReadonlyMap) => ReadonlyMap | O; (target: Map, predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => value is U, mapper: (value: U, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): Map | O; (target: ReadonlyMap, predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => value is U, mapper: (value: U, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): ReadonlyMap | O; (target: Map, predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => boolean, mapper: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): Map | O; (target: ReadonlyMap, predicate: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => boolean, mapper: (value: NoInfer, key: NoInfer, target: ReadonlyMap) => V, orElse: (target: ReadonlyMap) => O): ReadonlyMap | O; }; //#endregion export { findMapOrElse };