Skip to main content
variable sortByKey
import { sortByKey } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Sort by based on the key.

Use the spread operator (...), Array.prototype.sort() and String.localeCompare() to sort array of data.

type

<T = any>(
arr: T[],
key: string,
order?: SortByOrder,
) => unknown