Skip to main content
Module

x/fun/mod.ts>array.sort

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

Returns a new array conuaining elements of as sorted in ascending order according to the sort order defined by O.

Examples

import { ordNumber } from "./sortable.ts"; import { sort } from './array.ts'

sort(ordNumber)([3, 1, 2]) // [1, 2, 3]

Parameters

O: Sortable<B>

Returns

<A extends B>(as: ReadonlyArray<A>) => ReadonlyArray<A>