chore: formattato il codice e rimosso un vecchio file

This commit is contained in:
2023-01-10 01:36:29 +01:00
parent 476c0b4a71
commit 2901a1f899
7 changed files with 41 additions and 61 deletions
+2 -2
View File
@@ -57,8 +57,8 @@ export type SolutionStatus = 'pending' | 'correct' | 'wrong'
export type SolutionId = Id<Solution>
export type SolutionStat = {
sentSolutionsCount: number,
correctSolutionsCount: number,
sentSolutionsCount: number
correctSolutionsCount: number
}
export type Solution = {
+1 -6
View File
@@ -22,12 +22,7 @@ export function sortByNumericKey<T>(items: T[], keyFn: KeyFn<T, number>, ascendi
return sortByKey(compareNumberKeys, items, keyFn, ascending)
}
function sortByKey<T, K>(
compareFn: (a: K, b: K) => number,
items: T[],
keyFn: (item: T) => K,
ascending: boolean
) {
function sortByKey<T, K>(compareFn: (a: K, b: K) => number, items: T[], keyFn: (item: T) => K, ascending: boolean) {
const sortedList = [...items]
const order = ascending ? 1 : -1
sortedList.sort((a, b) => order * compareFn(keyFn(a), keyFn(b)))