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

Usage

import * as fun from "https://raw.githubusercontent.com/baetheus/fun/main/sortable.ts";

§Functions

between

Construct an exclusive between function over A from Sortable.

clamp

Construct an inclusive clamp function over A from Sortable.

fromCurriedSort

Create a Sortable from a curried Sort.

fromSort

Derives an Sortable from a Compare function.

gt

Construct a curried greater than function over A from Sortable.

gte

Construct a curried greater than or equal to function over A from Sortable.

lt

Construct a curried less than function over A from Sortable.

lte

Construct a curried less than or equal to function over A from Sortable.

max

Construct a maximum function over A from Sortable.

min

Construct a minimum function over A from Sortable.

premap

Derives an instance of Sortable by take an existing Sortable over D and a function that turns an L into D and returns an Sortable over L.

reverse

Derive an Sortable with the reverse ordering of an existing Sortable.

sign

Returns an Ordering from any number according to its relationship with 0.

struct

Derives an Sortable from a structs of Sortables. The derived Sortable will compare two structs starting with the first defined key and return the first ordering that is non-zero, otherwise the two structs are equal.

trivial

Create a trivial Sortable, where all values of A are considered equal.

tuple

Derives an Sortable from a tuple of Sortables. The derived Sortable will compare two tuples starting at index 0 and return the first ordering that is non-zero, otherwise the two tuples are equal.

§Interfaces

KindSortable

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

Sortable

A Sortable structure has the method sort.

§Type Aliases

Ordering

The ordering type is the expected output of any Compare function. The canonical example is the output of the Array.sort function. For any two values first and second, Ordering means the following:

Sort

The Sort function takes to values of the same type and returns an ordering, indicating whether first is less than, equal to, or greater than `second. See Ordering for the order.