@selfcommunity/utils
Version:
Utilities to integrate a Community.
22 lines (21 loc) • 698 B
TypeScript
/**
* Check if two arrays are equal
* @param a
* @param b
* @return boolean
*/
export declare const arraysEqual: (a: any, b: any) => boolean;
/**
* Group items from an array together by some criteria or value.
* @param {Array} arr The array to group items from
* @param {String|Function} criteria The criteria to group by
* @return {Object} The grouped object
*/
export declare const groupBy: (arr: any, criteria: any) => any;
/**
* Sort an array of objects by attr.
* @param arr The array to group items from
* @param attr Order attribute
* @param asc Sort asc/desc
*/
export declare const sortByAttr: (arr: any, attr: any, asc?: boolean) => any;