-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
* test 및 함수 추가
🦋 Changeset detectedLatest 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/getFirstHangulLetters.ts
Outdated
export function getFirstHangulLetters(str: string) { | ||
const words = str.split(' '); | ||
|
||
const firstHangulLetters = words.map(word => word.charAt(0)); | ||
|
||
return firstHangulLetters; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
매개변수가 한글인지 검증하는 로직이 필요하지 않을까요? 지금은 한글이 아니더라도 반환을 해주는데요. 함수명과 기능이 불일치하는 것 같아요. 그리고 매개변수명은 str
말고 더 직관적인 이름이 있을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 정정해보겠습니다.
@po4tion 추가했습니다. 확인 부탁드립니다. |
src/getFirstHangulLetters.ts
Outdated
/** | ||
* | ||
* @param getFirstHangulLetters | ||
* @description | ||
* 한글 문장을 입력받아서, 해당 한글 문장의 초성을을 리턴해줍니다. | ||
* 한글 문장이 아닌, 문장은 취급하지않습니다. 추가로 한글 문장 + 영어 문장의 경우에도 취급하지않습니다. | ||
*/ | ||
export function getFirstHangulLetters(text: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드가 하는 역할에 비해서, 메서드이름이 약간 일반적(general)이라고 생각했는데요,
왜냐하면 메서드 이름만 보고 띄어쓰기를 기준으로 나누고, 가장 앞의 글자들을 가져온다는것을 예측하기 힘들 것 같아요. 한번 고민해보겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메서드 이름을 getHangulAbbreviation()
나 getHangulAcronym()
은 어떨까요?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무 좋은 함수명들이네요, getHangulAcronym
이것이 오해의 소지 없이 정확히 함수의 역할을 설명하고 있는것 같아서, 사용하면 좋을 것 같은데 @KNU-K 님께서는 어떠신가요~?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getHangulAcronym
로 바로 수정하겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@okinawaa 제가 진행하겠습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 감사합니다..!! 연관된 파일 모두 챙겨주시면 감사하겠습니다~!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
명확히 다른기능이라, 두 가지 다른 PR로 진행하였으면 해요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵
Co-authored-by: 박찬혁 <[email protected]>
getFirstHangulLetters -> getHangulAcronym
export function isHangulOnly로 변경
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다
Co-authored-by: 박찬혁 <[email protected]>
src/getHangulAcronym.ts
Outdated
if (!isHangul(text)) { | ||
throw new Error('Invalid Hangul text, please input Hangul text only.'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parseHangul을 사용하면 내부적으로 에러처리까지해줘서 더 좋을 것 같아요
안쓰는 메소드 삭제
Co-authored-by: 박찬혁 <[email protected]>
Co-authored-by: 박찬혁 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
긴 작업 감사합니다 🚀
@okinawaa 감사합니다. |
* 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]>
feat : 문장의 각 단어 중 첫 문자만 뽑는 함수추가
issue 를 보고 해당 PR을 추가하게되었습니다
Overview
문장 내에서 단어의 첫 문자만 뽑는 함수를 추가하였습니다.
PR Checklist