import { partial } from "https://deno.land/x/fun@v2.0.0/decoder.ts";
A decoder over a heterogenous record type. This struct can have different values at each key or the key can not exist or the value can be undefined, and the resultant decoder will ensure that each key matches its corresponding decoder.
Examples
Example 1
Example 1
import * as D from "./decoder.ts";
const person = D.partial({ name: D.string, age: D.number });
const result1 = person({}); // Right({})
const result2 = person(null); // Left(DecodeError)
const result3 = person({ name: "Brandon" }); // Right({ name: "Brandon" })
const result4 = person({ name: "Brandon", age: 37 });
// Right({ name: "Brandon", age: 37 })