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

getSortableEither

import { getSortableEither } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";

Create a Sortable instance for Either given Sortable instances for both Left and Right types. Left values are sorted before Right values.

@example
import * as E from "./either.ts";
import * as S from "./string.ts";
import * as N from "./number.ts";

const sortableEither = E.getSortableEither(S.SortableString, N.SortableNumber);

const values = [E.right(3), E.left("b"), E.right(1), E.left("a")];
const sorted = values.sort((a, b) => sortableEither.sort(a, b));
// [Left("a"), Left("b"), Right(1), Right(3)]
function getSortableEither<A, B>(OB: Sortable<B>, OA: Sortable<A>): Sortable<Either<B, A>>;
§
getSortableEither<A, B>(OB: Sortable<B>, OA: Sortable<A>): Sortable<Either<B, A>>
[src]

§Type Parameters

§Parameters

§Return Type