Skip to content

Commit

Permalink
fix: fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Oct 31, 2024
1 parent 0d44ea9 commit aad4f13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 2 additions & 6 deletions src/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,15 @@ export function minBy<T>(arr: T[], fn: (val: T) => number) {
return
}

return arr.reduce((result, item) => {
return fn(result) < fn(item) ? result : item
}, arr[0])
return arr.reduce((result, item) => fn(result) < fn(item) ? result : item, arr[0])
}

export function maxBy<T>(arr: T[], fn: (val: T) => number) {
if (!arr.length) {
return
}

return arr.reduce((result, item) => {
return fn(result) > fn(item) ? result : item
}, arr[0])
return arr.reduce((result, item) => fn(result) > fn(item) ? result : item, arr[0])
}

export function mean(arr: number[]) {
Expand Down
4 changes: 3 additions & 1 deletion src/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ export function times<T>(num: number, fn: (index: number) => T) {
}

export function delay(time: number) {
return new Promise((resolve) => setTimeout(resolve, time))
return new Promise<void>((resolve) => {
setTimeout(resolve, time)
})
}

0 comments on commit aad4f13

Please sign in to comment.