Skip to main content
Module

x/fun/array.ts>getSortableArray

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function getSortableArray
import { getSortableArray } from "https://deno.land/x/fun@v2.0.0/array.ts";

Given an instance Sortable create a Sortable<ReadonlyArray>.

Examples

Example 1

import * as A from "./array.ts";
import { SortableNumber } from "./number.ts";

const { sort } = A.getSortableArray(SortableNumber);

const result1 = sort([1, 2], [1, 2]); // 0
const result2 = sort([1, 2], [1]); // 1
const result3 = sort([1, 2, 4], [1, 2, 3]); // -1

Returns

Sortable<ReadonlyArray<A>>