Skip to main content
Module

x/fun/mod.ts>comparable.partial

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function comparable.partial
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

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]>