partition
import { partition } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/set.ts";Given a Predicate or Refinement over A and a ReadonlySet return a Pair with a first value being a ReadonlySet of values that return true when applied to the refinement or predicate and a second value being a ReadonlySet of values that return false when applied to the predicate.
@example
import * as S from "./set.ts";
import { pipe } from "./fn.ts";
const set = S.set(1, 2, 3, 4);
const result = pipe(
set,
S.partition(n => n > 2),
); // [Set(3, 4), Set(1, 2)]
function partition<A, B extends A>(refinement: Refinement<A, B>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<B>, ReadonlySet<A>>;
§
partition<A, B extends A>(refinement: Refinement<A, B>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<B>, ReadonlySet<A>>
[src]Given a Predicate or Refinement over A and a ReadonlySet return a Pair with a first value being a ReadonlySet of values that return true when applied to the refinement or predicate and a second value being a ReadonlySet of values that return false when applied to the predicate.
@example
import * as S from "./set.ts";
import { pipe } from "./fn.ts";
const set = S.set(1, 2, 3, 4);
const result = pipe(
set,
S.partition(n => n > 2),
); // [Set(3, 4), Set(1, 2)]
§Parameters
§
refinement: Refinement<A, B>
[src]