import { sequence } from "https://deno.land/x/fun@v2.0.0/record.ts";
Sequence over an ReadonlyRecord of type V, inverting the relationship between V and ReadonlyRecord. This function also keeps the indexed types of in each V at covariant position 0. In other words sequence over [Option, Option] becomes Option<[number, string]>.
Examples
Example 1
Example 1
import * as R from "./record.ts";
import * as O from "./option.ts";
const sequence = R.sequence(O.ApplicableOption);
const result1 = sequence({ one: O.some(1), two: O.some("Hello")}); // Some({ one: 1, two: "Hello"})
const result2 = sequence({ one: O.none, two: O.some("Uh Oh")}); // None
Type Parameters
V extends Kind
Returns
<VS extends ReadonlyRecord<AnySub<V>>>(values: NonEmptyRecord<VS>) => Sequence<V, VS>