Skip to main content
Module

x/itertools/mod.ts>sorted

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Latest
function sorted
import { sorted } from "https://deno.land/x/itertools@v1.1.2/mod.ts";

Return a new sorted list from the items in iterable.

Has two optional arguments:

  • keyFn specifies a function of one argument providing a primitive identity for each element in the iterable. that will be used to compare. The default value is to use a default identity function that is only defined for primitive types.

  • reverse is a boolean value. If true, then the list elements are sorted as if each comparison were reversed.

Parameters

iterable: Iterable<T>
optional
keyFn: (v: T) => Primitive = [UNSUPPORTED]
optional
reverse = [UNSUPPORTED]

Returns

Array<T>