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

partitionMap

import { partitionMap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/set.ts";

Given a function A -> Either<J, I> and a ReadonlySet return a Pair(ReadonlySet, ReadonlySet) by applying every value A in the set to the partitioning function.

@example
import * as S from "./set.ts";
import * as E from "./either.ts";
import { pipe } from "./fn.ts";

const set = S.set("one", "two", "three", "four");

const result = pipe(
  set,
  S.partitionMap(s => s.includes('o') ? E.right(s) : E.left(s.length)),
); // [Set("one", "two", "four"), Set(5)]
function partitionMap<A, I, J>(fai: (a: A) => Either<J, I>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<I>, ReadonlySet<J>>;
§
partitionMap<A, I, J>(fai: (a: A) => Either<J, I>): (ua: ReadonlySet<A>) => Pair<ReadonlySet<I>, ReadonlySet<J>>
[src]

§Type Parameters

§Parameters

§
fai: (a: A) => Either<J, I>
[src]

§Return Type

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