mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Refactored dashboard sort logic.
This commit is contained in:
parent
42e87a4691
commit
62b032ab19
8 changed files with 32 additions and 40 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue