Group items into buckets keyed by their subtype, optionally sorting within each bucket. Items whose getSubType yields an empty/undefined value fall into the "other" bucket. Insertion order is preserved within a bucket unless compare is supplied.
getSubType
undefined
"other"
compare
The items to group.
Derives an item's subtype key.
Optional
Optional within-bucket sort comparator.
A map of subtype key → items in that bucket.
Group items into buckets keyed by their subtype, optionally sorting within each bucket. Items whose
getSubTypeyields an empty/undefinedvalue fall into the"other"bucket. Insertion order is preserved within a bucket unlesscompareis supplied.