import { comparable } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { partial } = comparable;
Create a eq that compares, key for key, structs according to the structure of the eqs passed into struct. It allows the values in the struct to be optional or null.
Examples
Example 1
Example 1
import { struct, number, string } from "./comparable.ts";
const { compare } = struct({ name: string, age: number });
const brandon = { name: "Brandon", age: 37 };
const emily = { name: "Emily", age: 32 };
const result1 = compare(brandon)(emily); // false
const result2 = compare(brandon)(brandon); // true
Parameters
comparables: readonly [K in keyof A]: Comparable<A[K]>
Returns
Comparable<readonly [K in keyof A]?: A[K]>