Refactored dashboard sort logic.

This commit is contained in:
Mike Cao committed 2022-08-04 21:37:18 -07:00
1 parent 42e87a4691
commit 62b032ab19
8 files changed
+32 -40

No files matched your search

+7
View File
@@ -9,3 +9,10 @@ export function chunk(arr, size) {
return chunks;
}
export function sortArrayByMap(arr, map = [], key) {
if (!arr) return [];
if (map.length === 0) return arr;
return map.map(id => arr.find(item => item[key] === id));
}