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

feat(utils): uniq 신규 유틸 함수 추가 #223

Merged
merged 1 commit into from
Jun 14, 2024
Merged

feat(utils): uniq 신규 유틸 함수 추가 #223

merged 1 commit into from
Jun 14, 2024

Conversation

ssi02014
Copy link
Contributor

Overview

Issue: #222

중복 요소를 제외한 배열을 반환하는 함수입니다.

기본적으로 원시 값에 대해서만 중복 요소를 판단하며, 필요 시 2번째 인자인 iteratee 함수 결과로 중복 요소임을 판단 할 수 있습니다.

uniq([1, 2, 3]); // [1, 2, 3] 
uniq([1, 2, 2, 2, 3]); // [1, 2, 3] 
const testArr = [
  { id: 1, name: 'John' },
  { id: 2, name: 'Jane' },
  { id: 1, name: 'John' },
];

uniq(testArr, (item) => item.id === 1);
/*
  [
    { id: 1, name: 'John' },
    { id: 2, name: 'Jane' },
  ];
*/

uniq([1, 2, 2.1, 2.2, 2.3, 3], (item) => Math.floor(item)); // [1, 2, 3]

PR Checklist

  • All tests pass.
  • All type checks pass.
  • I have read the Contributing Guide document.
    Contributing Guide

Copy link

changeset-bot bot commented Jun 14, 2024

🦋 Changeset detected

Latest commit: 3a06985

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modern-kit/utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ssi02014 ssi02014 requested a review from Sangminnn June 14, 2024 10:02
@ssi02014 ssi02014 self-assigned this Jun 14, 2024
@ssi02014 ssi02014 added feature 새로운 기능 추가 @modern-kit/utils @modern-kit/utils labels Jun 14, 2024
Copy link

codecov bot commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.81%. Comparing base (b0a08c9) to head (3a06985).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
+ Coverage   95.75%   95.81%   +0.05%     
==========================================
  Files          88       89       +1     
  Lines         896      908      +12     
  Branches      209      211       +2     
==========================================
+ Hits          858      870      +12     
  Misses         32       32              
  Partials        6        6              
Components Coverage Δ
@modern-kit/react 92.43% <ø> (ø)
@modern-kit/utils 100.00% <100.00%> (ø)

@ssi02014 ssi02014 merged commit b4b1578 into main Jun 14, 2024
3 checks passed
@ssi02014 ssi02014 deleted the feat/uniq branch June 14, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 추가 @modern-kit/utils @modern-kit/utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant