Skip to content

Commit

Permalink
chore: simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
holazz committed Jul 13, 2022
1 parent be80e43 commit e910d49
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/math/useMin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ export function useMin(...args: MaybeComputedRef<number>[]): ComputedRef<number>
* @param nums
*/
export function useMin(...args: any[]): ComputedRef<number> {
return computed(() => Math.min(...args.flatMap((i) => {
const v = resolveUnref(i)
if (Array.isArray(v))
return v.map(i => resolveUnref(i))
return [v]
})))
return computed(() => Math.min(
...args.flatMap((i) => {
const v = resolveUnref(i)
if (Array.isArray(v))
return v.map(resolveUnref)
return [v]
})),
)
}

0 comments on commit e910d49

Please sign in to comment.