import { decoder } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { tuple } = decoder;
A decoder over a heterogenous tuple. This tuple can have different values for each tuple element, but is constrained to a specific size and order.
Examples
Example 1
Example 1
import * as D from "./decoder.ts";
const tuple = D.tuple(D.string, D.number);
const result1 = tuple([]); // Left(DecodeError)
const result2 = tuple([3, "Hello"]); // Left(DecodeError)
const result3 = tuple(["Brandon", 37]); // Right(["Brandon", 37])