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

fromSort

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

Derives an Sortable from a Compare function.

@example
import { clamp, lte, min, fromSort, sign } from "./sortable.ts";
import { pipe } from "./fn.ts";

const date = fromSort<Date>(
  (fst, snd) => sign(fst.valueOf() - snd.valueOf())
);

const now = new Date();
const later = new Date(Date.now() + 60 * 60 * 1000);
const tomorrow = new Date(Date.now() + 24 * 60 * 60 * 1000);

const result1 = pipe(now, lte(date)(later)); // true
const result2 = pipe(tomorrow, clamp(date)(now, later)); // later
const result3 = pipe(tomorrow, min(date)(now)); // now
function fromSort<A>(sort: Sort<A>): Sortable<A>;
§
fromSort<A>(sort: Sort<A>): Sortable<A>
[src]

§Type Parameters

§Parameters

§
sort: Sort<A>
[src]

§Return Type