import { option } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { partition } = option;
Given a refinement or predicate, return a function that splits an Option into a Pair<Option, Option>. Due to the nature of the option type this will always return Pair<Some, None>, Pair<None, None>, or Pair<None, Some>.
Examples
Example 1
Example 1
import * as O from "./option.ts";
const partition = O.partition((n: number) => n > 0);
const result1 = partition(O.some(1)); // [Some(1), None]
const result2 = partition(O.some(0)); // [None, Some(0)]
const result3 = partition(O.none); // [None, None]
Type Parameters
B extends A
Parameters
predicate: Predicate<A>