@teamsnap/teamsnap-ui
Version:
a CSS component library for TeamSnap
17 lines (16 loc) • 619 B
TypeScript
/**
* @name sortBy
*
* @description
* The sortBy method allows for multiple sorting types, including a custom sort order and even a custom
* sorting method `sortFn`. This accepts an arrayToSort as well as an object containing custom sort options.
*
* @example
* import { sortBy } from 'utils/sort
*
* sortBy(arrayToSort, { name: 'createdAt', sortType: 'date', isReverse: true })
* sortBy(arrayToSort, { name: 'phonetics', sortType: ['charlie', 'alpha', 'bravo'] })
* sortBy(arrayToSort, { name: 'test', sortFn: (a,b) => b - a })
*
*/
export declare const sortBy: (array: any, options?: {}) => any;