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)]