Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as mod from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/comparable.ts";

Comparable is a structure that has an idea of comparability. Comparability means that two of the same type of object can be compared such that the condition of comparison can be true or false. The canonical comparison is equality.

§Variables

boolean

A Comparable that compares booleans using strict equality.

number

A Comparable that compares number using strict equality.

SchemableComparable

The canonical implementation of Schemable for a Comparable. It contains the methods unknown, string, number, boolean, literal, nullable, undefinable, record, array, tuple, struct, partial, intersect, union, and lazy.

string

A Comparable that compares strings using strict equality.

unknown

A Comparable that can compare any unknown values (and thus can compare any values). Underneath it uses strict equality for the comparison.

§Functions

array

Create a Comparable for array types.

fromCompare

Create a Comparable from a Compare function.

intersect

Create a Comparable for intersection types.

lazy

Create a lazy Comparable that defers evaluation.

literal

Creates a Comparable that compares a union of literals using strict equality.

method

Create a Comparable for method types.

nullable

Create a Comparable for nullable types.

partial

Create a Comparable for partial types.

premap

Create a Comparable using a Comparable and a function that takes a type L and returns a type D.

readonly

Create a Comparable for Readonly types.

record

Create a Comparable for record types.

struct

Create a Comparable for struct types.

thunk

Create a Comparable for thunk types.

tuple

Create a Comparable for tuple types.

undefinable

Create a Comparable for undefined types.

union

Create a Comparable from two other Comparables. The resultant Comparable checks that any two values are equal according to at least one of the supplied eqs.

§Interfaces

Comparable

A Comparable is an algebra with a notion of equality. Specifically, a Comparable for a type T has an equal method that determines if the two objects are the same. Comparables can be combined, like many algebraic structures. The combinators for Comparable in fun can be found in comparable.ts.

KindComparable

Specifies Comparable as a Higher Kinded Type, with covariant parameter A corresponding to the 0th index of any Substitutions.

KindContraComparable

Specifies Comparable as a Higher Kinded Type, with contravariant parameter D corresponding to the 0th index of any Substitutions.

§Type Aliases

Compare

The compare function in a Comparable.

TypeOf

Extract the type parameter from a Comparable.