feat: add pinned items group at the top

This commit is contained in:
thecodrr
2020-09-15 10:15:05 +05:00
parent fe369e6771
commit 090be2642f

View File

@@ -1,7 +1,7 @@
export function groupBy(arr, key) {
let groups = {};
let groups = { Pinned: [] };
arr.forEach((item) => {
let groupTitle = key(item);
let groupTitle = item.pinned ? "Pinned" : key(item);
let group = groups[groupTitle]
? groups[groupTitle]
: (groups[groupTitle] = []);