hd-utils
Version:
A handy utils for modern JS developers
8 lines (7 loc) • 420 B
TypeScript
/**
* @description It takes an array of objects and sorts them by array of multiple properties.
* if the property starts with "-" then it will be descending order otherwize ascending order
* @param {T[]} arr - the array to be sorted
* @param {string[]} proprieties - an array of strings, each string is a property name
*/
export default function sortByMultiProperties<T = {}>(arr: T[], proprieties: string[]): T[];