Added some filtering to participant component
This commit is contained in:
committed by
Erik Tiekstra
parent
99db911f39
commit
8a9b0049d4
@@ -0,0 +1,12 @@
|
||||
import { SortBy } from '@dafa-models/sort-by.model';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function sort(data: any[], sortBy: SortBy): any[] {
|
||||
const reverse = sortBy.reverse ? -1 : 1;
|
||||
return [...data].sort((a, b) => {
|
||||
const first = a[sortBy.key];
|
||||
const second = b[sortBy.key];
|
||||
|
||||
return reverse * (+(first > second) - +(second > first));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user