import { filterMap } from "https://deno.land/x/fun@v2.0.0/record.ts";
Given a function over the values in a ReadonlyArray returning an Option, return a function thatsimultaneously filters and maps over the values in a ReadonlyRecord.
Examples
Example 1
Example 1
import * as R from "./record.ts";
import * as O from "./option.ts";
import { pipe } from "./fn.ts";
const result = pipe(
{ one: 1, two: 2, three: 3 },
R.filterMap(n => n > 1 ? O.some(`${n} is big enough`) : O.none),
); // { two: "2 is big enough", three: "3 is big enough" }
Returns
(ua: ReadonlyRecord<A>) => ReadonlyRecord<I>