fix: attach alias with tag for sorting/grouping

This commit is contained in:
thecodrr
2021-11-18 11:01:12 +05:00
parent 19f0e55362
commit 9ccb0fee12
3 changed files with 19 additions and 10 deletions

View File

@@ -47,11 +47,12 @@ export default class CachedCollection extends IndexedCollection {
return Array.from(this.map.values());
}
getItems(sortFn = (u) => u.dateCreated) {
getItems(sortFn = (u) => u.dateCreated, manipulate = (item) => item) {
let items = [];
this.map.forEach((value) => {
if (!value || value.deleted || !value.id) return;
items[items.length] = value;
value = manipulate ? manipulate(value) : value;
items.push(value);
});
return sort(items).desc(sortFn);
}