Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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>>;
function partition<A>(predicate: Predicate<A>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, ReadonlySet<A>>;
function partition<A>(predicate: Predicate<A>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, 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)]

§Type Parameters

§
B extends A
[src]

§Parameters

§
refinement: Refinement<A, B>
[src]

§Return Type

§
(ua: ReadonlySet<A>) => Pair<ReadonlySet<B>, ReadonlySet<A>>
[src]
§
partition<A>(predicate: Predicate<A>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, ReadonlySet<A>>
[src]

§Type Parameters

§Parameters

§
predicate: Predicate<A>
[src]

§Return Type

§
(ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, ReadonlySet<A>>
[src]
§
partition<A>(predicate: Predicate<A>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, ReadonlySet<A>>
[src]

§Type Parameters

§Parameters

§
predicate: Predicate<A>
[src]

§Return Type

§
(ua: ReadonlySet<A>) => Pair<ReadonlySet<A>, ReadonlySet<A>>
[src]