Skip to main content
Module

x/fun/mod.ts>eq.partial

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function eq.partial
import { eq } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { partial } = eq;

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 "./eq.ts";

const { equals } = struct({ name: string, age: number });

const brandon = { name: "Brandon", age: 37 };
const emily = { name: "Emily", age: 32 };

const result1 = equals(brandon)(emily); // false
const result2 = equals(brandon)(brandon); // true

Parameters

Eqs: readonly [K in keyof A]: Eq<A[K]>

Returns

Eq<readonly [K in keyof A]?: A[K]>