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

tuple

import { tuple } from "https://raw.githubusercontent.com/baetheus/fun/main/sortable.ts";

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.

@example
import { tuple, lt } from "./sortable.ts"
import { SortableNumber } from "./number.ts";
import { SortableString } from "./string.ts";
import { pipe } from "./fn.ts";

const tup = tuple(SortableNumber, SortableString);

const result1 = pipe([1, "a"], lt(tup)([2, "b"])); // true
const result2 = pipe([1, "a"], lt(tup)([1, "b"])); // true
const result3 = pipe([1, "a"], lt(tup)([1, "a"])); // false
function tuple<T extends ReadonlyArray<unknown>>(...sorts: [K in keyof T]: Sortable<T[K]>): Sortable<Readonly<T>>;
§
tuple<T extends ReadonlyArray<unknown>>(...sorts: [K in keyof T]: Sortable<T[K]>): Sortable<Readonly<T>>
[src]

§Type Parameters

§
T extends ReadonlyArray<unknown>
[src]

§Parameters

§
...sorts: [K in keyof T]: Sortable<T[K]> optional
[src]

§Return Type

§
Sortable<Readonly<T>>
[src]