Skip to content

Commit

Permalink
fix(util): math util 함수의 반복문을 for...of 문으로 수정 (#304)
Browse files Browse the repository at this point in the history
* fix: math util 함수의 반복문을 for...of 문으로 수정

* Create strange-mayflies-provide.md

---------

Co-authored-by: Gromit (전민재) <[email protected]>
  • Loading branch information
Collection50 and ssi02014 committed Jul 5, 2024
1 parent cf117da commit eba8634
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-mayflies-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@modern-kit/utils": patch
---

fix(util): math util 함수의 반복문을 for...of 문으로 수정 - @Collection50
4 changes: 2 additions & 2 deletions packages/utils/src/math/max/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export function max<T>(
let maxValue = Number.MIN_SAFE_INTEGER;
let maxItem = arr[0];

arr.forEach((item) => {
for (const item of arr) {
const value = iteratee(item);

if (value > maxValue) {
maxItem = item;
maxValue = value;
}
});
}

return maxItem;
}
4 changes: 2 additions & 2 deletions packages/utils/src/math/min/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ export function min<T>(
let minValue = Number.MAX_SAFE_INTEGER;
let minItem = arr[0];

arr.forEach((item) => {
for (const item of arr) {
const value = iteratee(item);

if (value < minValue) {
minItem = item;
minValue = value;
}
});
}

return minItem;
}

0 comments on commit eba8634

Please sign in to comment.