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 : 문장의 각 단어 중 첫 문자만 뽑는 함수추가 ( #128 이슈에 대한 ) #133

Merged
merged 26 commits into from
Jun 29, 2024

Conversation

KNU-K
Copy link
Contributor

@KNU-K KNU-K commented Jun 25, 2024

feat : 문장의 각 단어 중 첫 문자만 뽑는 함수추가

test 및 함수 추가

issue 를 보고 해당 PR을 추가하게되었습니다

Overview

문장 내에서 단어의 첫 문자만 뽑는 함수를 추가하였습니다.

PR Checklist

  • I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

Copy link

changeset-bot bot commented Jun 25, 2024

🦋 Changeset detected

Latest commit: 3ffcd89

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

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

Copy link

vercel bot commented Jun 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-hangul ❌ Failed (Inspect) Jun 29, 2024 1:51pm

Comment on lines 1 to 7
export function getFirstHangulLetters(str: string) {
const words = str.split(' ');

const firstHangulLetters = words.map(word => word.charAt(0));

return firstHangulLetters;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매개변수가 한글인지 검증하는 로직이 필요하지 않을까요? 지금은 한글이 아니더라도 반환을 해주는데요. 함수명과 기능이 불일치하는 것 같아요. 그리고 매개변수명은 str말고 더 직관적인 이름이 있을 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 정정해보겠습니다.

@KNU-K
Copy link
Contributor Author

KNU-K commented Jun 28, 2024

@po4tion 추가했습니다. 확인 부탁드립니다.

@KNU-K KNU-K requested a review from po4tion June 28, 2024 18:11
Comment on lines 3 to 10
/**
*
* @param getFirstHangulLetters
* @description
* 한글 문장을 입력받아서, 해당 한글 문장의 초성을을 리턴해줍니다.
* 한글 문장이 아닌, 문장은 취급하지않습니다. 추가로 한글 문장 + 영어 문장의 경우에도 취급하지않습니다.
*/
export function getFirstHangulLetters(text: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메서드가 하는 역할에 비해서, 메서드이름이 약간 일반적(general)이라고 생각했는데요,
왜냐하면 메서드 이름만 보고 띄어쓰기를 기준으로 나누고, 가장 앞의 글자들을 가져온다는것을 예측하기 힘들 것 같아요. 한번 고민해보겠습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메서드 이름을 getHangulAbbreviation()getHangulAcronym()은 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extractFirstHangulFromWords()extractFirstHangul() 도 고려하고 있습니다.

word들에서 첫번째 한글을 추출해서 list 로 return 해주는게 기능이라 해당 이름도 좋을 것 같습니다.

꽤나 유용할 것 같은 기능으로 생각됩니다. @okinawaa

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

너무 좋은 함수명들이네요, getHangulAcronym 이것이 오해의 소지 없이 정확히 함수의 역할을 설명하고 있는것 같아서, 사용하면 좋을 것 같은데 @KNU-K 님께서는 어떠신가요~?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getHangulAcronym로 바로 수정하겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okinawaa 제가 진행하겠습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 감사합니다..!! 연관된 파일 모두 챙겨주시면 감사하겠습니다~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#129 이부분 진행할까하는데, 혹시 진행하면서 PR에 포함시켜도 될까요??
@okinawaa

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

명확히 다른기능이라, 두 가지 다른 PR로 진행하였으면 해요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/_internal/hangul.ts Outdated Show resolved Hide resolved
getFirstHangulLetters -> getHangulAcronym
export function isHangulOnly로 변경
Copy link
Member

@okinawaa okinawaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래와 같은 lint오류 세가지가 발생하고 있어서, 해결부탁드립니다

image

Copy link
Contributor Author

@KNU-K KNU-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정했습니다

Comment on lines 11 to 13
if (!isHangul(text)) {
throw new Error('Invalid Hangul text, please input Hangul text only.');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseHangul을 사용하면 내부적으로 에러처리까지해줘서 더 좋을 것 같아요

src/getHangulAcronym.ts Outdated Show resolved Hide resolved
src/getHangulAcronym.ts Outdated Show resolved Hide resolved
안쓰는 메소드 삭제
KNU-K and others added 2 commits June 29, 2024 22:41
okinawaa
okinawaa previously approved these changes Jun 29, 2024
Copy link
Member

@okinawaa okinawaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

긴 작업 감사합니다 🚀

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.79%. Comparing base (f0195b2) to head (3ffcd89).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #133   +/-   ##
=======================================
  Coverage   98.78%   98.79%           
=======================================
  Files          14       15    +1     
  Lines         247      249    +2     
  Branches       55       55           
=======================================
+ Hits          244      246    +2     
  Misses          3        3           

@okinawaa okinawaa merged commit b0e1184 into toss:main Jun 29, 2024
8 of 9 checks passed
@github-actions github-actions bot mentioned this pull request Jun 29, 2024
@KNU-K
Copy link
Contributor Author

KNU-K commented Jun 29, 2024

@okinawaa 감사합니다.

seungrodotlee pushed a commit to seungrodotlee/es-hangul that referenced this pull request Jul 6, 2024
* feat : 문장의 각 단어 중 첫 문자만 뽑는 함수추가

* test 및 함수 추가

* add : 한글 문장인지 여부 판별 함수 추가

* fix : 한글 문장인지 여부 판별 기저 및 오류 추가 / arg 이름 변경

test 추가

* fix: src/_internal/hangul.ts

Co-authored-by: 박찬혁 <[email protected]>

* fix : rename function

getFirstHangulLetters -> getHangulAcronym

* fix : rename function

export function isHangulOnly로 변경

* fix : lint error

* fix : index에 추가

* chore : doc 추가

* fix : 문서화 한글 영어 바뀐거 바로 변경

* fix : isHangul로 대체 toss#136 으로

* chore : doc수정

* Update docs/src/pages/docs/api/getHangulAcronym.en.mdx

Co-authored-by: 박찬혁 <[email protected]>

* fix : Update hangul.ts

안쓰는 메소드 삭제

* Update getHangulAcronym.ko.mdx

* Update getHangulAcronym.en.mdx

* Update src/getHangulAcronym.ts

Co-authored-by: 박찬혁 <[email protected]>

* Update src/getHangulAcronym.ts

Co-authored-by: 박찬혁 <[email protected]>

* Update getHangulAcronym.ts

* Update getHangulAcronym.spec.ts

* Create fair-brooms-drive.md

---------

Co-authored-by: 박찬혁 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants