Skip to main content
Module

x/denofun/sort.ts>default

Small utility library containing functions, monads and other fun stuff.
Latest
function default
import { default } from "https://deno.land/x/denofun@v0.2.0/sort.ts";

sort performs a sorting of array or string via provided sorting function, sorting function has to accept two arguments and return postive number if first argument is bigger than second, 0 if equal and negative number if lesser

Parameters

fn: (a: T, b: T) => number

a sorting function, has to accept two arguments and return negative number, 0 or positive number

xs: T[]

array or string to be sorted

Returns

T[]

a sorted array or string