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]: sum #261

Closed
1 of 2 tasks
ssi02014 opened this issue Jun 25, 2024 · 4 comments
Closed
1 of 2 tasks

[Feature]: sum #261

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

Comments

@ssi02014
Copy link
Contributor

ssi02014 commented Jun 25, 2024

Package Scope

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

Overview

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

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

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

Default

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

Iteratee

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

안녕하세요 @ssi02014 !

해당 이슈와 #262 를 제가 맡고 싶습니다 !

@ssi02014
Copy link
Contributor Author

@Collection50 감사합니다! 할당완료했습니다! 타입가드 쪽은 min,max와 유사하게 작업해주시면 감사드립니다 :)

@Collection50
Copy link
Contributor

@Collection50 감사합니다! 할당완료했습니다! 타입가드 쪽은 min,max와 유사하게 작업해주시면 감사드립니다 :)

확인입니다 !

@Collection50
Copy link
Contributor

@ssi02014 해당 이슈 close 해주시면 좋을 것 같아요 !!

@ssi02014 ssi02014 closed this as completed Jul 1, 2024
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

No branches or pull requests

2 participants