Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: average #262

Closed
1 of 2 tasks
ssi02014 opened this issue Jun 25, 2024 · 3 comments · Fixed by #287
Closed
1 of 2 tasks

[Feature]: average #262

ssi02014 opened this issue Jun 25, 2024 · 3 comments · Fixed by #287
Assignees
Labels
feature 새로운 기능 추가 @modern-kit/react @modern-kit/react

Comments

@ssi02014
Copy link
Contributor

Package Scope

  • 기존 패키지에 기능 추가
  • 새로운 패키지
  • Package name: @modern-kit/utils/math

Overview

배열에 있는 값의 평균을 계산합니다.

기본적으로 숫자 배열에서 값의 평균을 계산합니다. 그 외 타입의 경우 두 번째 인자인 iteratee 함수의 결과를 통해 평균 값을 계산합니다.

타입 가드가 원활하게 진헹되어야 합니다. ex) min, max

Default

const arr = [1, 2, 3, 4];
const result = average(arr); // 2.5
// iteratee가 없는데 숫자 외 타입 배열을 넣으면 타입 에러 발생해야 함

Iteratee

const arr = [
  { value: 1 },
  { value: 2 },
  { value: 3 },
  { value: 4 },
];
const result = average(arr, (item) => item.value); // 2.5
// 숫자를 반환하지 않으면 타입 에러 발생해야 함
@ssi02014 ssi02014 added feature 새로운 기능 추가 @modern-kit/react @modern-kit/react labels Jun 25, 2024
@Collection50 Collection50 mentioned this issue Jun 26, 2024
2 tasks
@ssi02014
Copy link
Contributor Author

ssi02014 commented Jun 26, 2024

@Collection50 엇 작업자 할당이 안되네요 요상한.. 댓글 한번 남겨주시면 할당하겠습니다

@ssi02014 ssi02014 self-assigned this Jun 26, 2024
@Collection50
Copy link
Contributor

제가 할당받고 싶습니다 ! 😊 @ssi02014

@ssi02014 ssi02014 assigned Collection50 and unassigned ssi02014 Jun 26, 2024
@ssi02014
Copy link
Contributor Author

@Collection50 감사합니다 !! 댓글을 달아서 participant 에 추가되야 담당자 할당이 가능하네요 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 추가 @modern-kit/react @modern-kit/react
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants