From aad4f134e806dd8768f96fae2b28df61f0c824c6 Mon Sep 17 00:00:00 2001 From: haoziqaq <357229046@qq.com> Date: Thu, 31 Oct 2024 17:34:10 +0800 Subject: [PATCH] fix: fix lint error --- src/math.ts | 8 ++------ src/number.ts | 4 +++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/math.ts b/src/math.ts index ef57d00..51c2d94 100644 --- a/src/math.ts +++ b/src/math.ts @@ -13,9 +13,7 @@ export function minBy(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(arr: T[], fn: (val: T) => number) { @@ -23,9 +21,7 @@ export function maxBy(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 mean(arr: number[]) { diff --git a/src/number.ts b/src/number.ts index fbedcd6..232ab1c 100644 --- a/src/number.ts +++ b/src/number.ts @@ -41,5 +41,7 @@ export function times(num: number, fn: (index: number) => T) { } export function delay(time: number) { - return new Promise((resolve) => setTimeout(resolve, time)) + return new Promise((resolve) => { + setTimeout(resolve, time) + }) }