UNPKG

js-servus

Version:

A utility library for common JavaScript/TypeScript tasks.

11 lines (10 loc) 436 B
export declare class ArrayUtils { /** * Sorts an array of objects by a specified property. * @param data - Array of objects to sort. * @param key - The key (property name) to sort by. * @param order - Sort order: 'asc' for ascending, 'desc' for descending. Defaults to 'asc'. * @returns The sorted array of objects. */ static sortByLabel<T>(data: T[], key: keyof T, order?: 'asc' | 'desc'): T[]; }