Function used to group an array of objects into a an object with a value of user[]. Where the object's key represents that group ex: [{a:"apple"}, {}a:'orange'}, {a:"apple"}] => {"apple": [{a:"apple"}, {a:"apple"}], 'orange": [{a:"orange"}]}
items to be groups
key by which to group them
This function sorts a given array, then groups it by a key, then sorts the inner group. Each sort is optional and if not given it will leave the array in the given order. outerSortOptions - is the sorting options preformed before the array is grouped. innerSortOptions - is the sort that is preformed after the array is grouped
the user model array to be grouped.
is the key used to group the array by a specific key
{outerSortOptions?: SortBy, innerSortOptions?: SortBy} - The sorting options
Takes and object that represents users grouped by a key and turns it into an array. For example {Female: user[], Male: user[]} => user[]
group to reduce to array
the only function that would be exported if this were a package. This function takes an array of user models and outputs them into the expected order. It works by:
users that are used to create the group and sorts
User[][] - a user array of arrays where each group is in its own individual array.
The function that is used for all sorting objects. It takes a key and a direction on which to sort with. It can be used on numbers, strings, and dates.
the array of objects in which to sort.
the options used to preform the sort
The sorting function that is used to sort items in a group
the grouped items
the sort options used to sort the items in the group: key and ordering.
Generated using TypeDoc
an type that is used to define the data structure when user models are grouped by a key