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://raw.githubusercontent.com/baetheus/fun/main/option.ts";

Map and partition over the inner value of an Option at the same time. If the option passed is None then the result is [None, None], otherwise Right will result in [Some, None], and Left will result in [None, Some].

@example
import * as O from "./option.ts";
import * as E from "./either.ts";

const partitioner = (n: number) => n > 0 ? E.right(n) : E.left(n * -1);
const partitionMap = O.partitionMap(partitioner);

const result1 = partitionMap(O.some(1)); // [Some(1), None]
const result2 = partitionMap(O.some(-1)); // [None, Some(1)]
const result3 = partitionMap(O.none); // [None, None]
function partitionMap<A, I, J>(fai: (a: A) => Either<J, I>): (ua: Option<A>) => Pair<Option<I>, Option<J>>;
§
partitionMap<A, I, J>(fai: (a: A) => Either<J, I>): (ua: Option<A>) => Pair<Option<I>, Option<J>>
[src]

§Type Parameters

§Parameters

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

§Return Type

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