Skip to main content

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Downloads1/wk
Published2 years ago (0.215.0)

Functions

f
sortBy<T>(
array: readonly T[],
selector:
((el: T) => number)
| ((el: T) => string)
| ((el: T) => bigint)
| ((el: T) => Date),
options?: SortByOptions
): T[]
4 overloads

Returns all elements in the given collection, sorted by their result using the given selector. The selector function is called only once for each element. Ascending or descending order can be specified.

Type Aliases

T
Order = "asc" | "desc"

Order option for SortByOptions.

T
SortByOptions = { order: Order; }

Options for sortBy.

  • order: Order
    No documentation available

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/collections

Import symbol

import * as mod from "@std/collections/sort_by";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/collections/sort_by";