mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
feat: add default group options
This commit is contained in:
@@ -41,7 +41,15 @@ const KEY_SELECTORS = {
|
||||
* @param {GroupOptions} options
|
||||
* @returns Grouped array
|
||||
*/
|
||||
export function groupArray(array, options) {
|
||||
export function groupArray(
|
||||
array,
|
||||
options = {
|
||||
groupId: undefined,
|
||||
sortBy: "dateEdited",
|
||||
groupBy: "dateEdited",
|
||||
sortDirection: "desc",
|
||||
}
|
||||
) {
|
||||
const keySelector = KEY_SELECTORS[options.groupId || "default"];
|
||||
if (options.sortBy && options.sortDirection)
|
||||
fastsort(array).by(getSortSelectors(options));
|
||||
|
||||
Reference in New Issue
Block a user