import { partition } from "https://deno.land/x/fun@v2.0.0-alpha.6/record.ts";
Given a refinement or predicate, return a function that splits a ReadonlyRecord into a Pair of ReadonlyRecords, with the first record containing the values for which the predicate/refinement returned true and the second record containing the values for which the predicate/refinement returned false.
Examples
Example 1
Example 1
import * as R from "./record.ts";
import { pipe } from "./fn.ts";
const result = pipe(
{ one: 1, two: 2, three: 3 },
R.partition(n => n > 1),
); // [{ two: 2, three: 3 }, { one: 1 }]
Type Parameters
I extends A
Returns
(ua: ReadonlyRecord<A>) => Pair<ReadonlyRecord<I>, ReadonlyRecord<A>>
Parameters
predicate: (a: A, key: string) => boolean
Returns
(ua: ReadonlyRecord<A>) => Pair<ReadonlyRecord<A>, ReadonlyRecord<A>>