-
Notifications
You must be signed in to change notification settings - Fork 102
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
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c811e8d
feat : 문장의 각 단어 중 첫 문자만 뽑는 함수추가
KNU-K 2b7fbd4
add : 한글 문장인지 여부 판별 함수 추가
KNU-K cc53591
fix : 한글 문장인지 여부 판별 기저 및 오류 추가 / arg 이름 변경
KNU-K dcecb15
fix: src/_internal/hangul.ts
KNU-K b31a5b3
fix : rename function
KNU-K 2e2b134
fix : rename function
KNU-K ea4cb1b
Merge branch 'main' of https://github.com/KNU-K/es-hangul
KNU-K 83fd467
Merge branch 'main' into main
KNU-K 7bd33ed
fix : lint error
KNU-K fffd30e
Merge branch 'main' of https://github.com/KNU-K/es-hangul
KNU-K 1d74c1e
fix : index에 추가
KNU-K e5e7765
chore : doc 추가
KNU-K 9c72739
fix : 문서화 한글 영어 바뀐거 바로 변경
KNU-K 1ba5c31
Merge branch 'main' into main
KNU-K 53544bd
fix : isHangul로 대체 #136 으로
KNU-K 444e217
Merge branch 'main' of https://github.com/KNU-K/es-hangul
KNU-K 4afa4d9
chore : doc수정
KNU-K 8079b7d
Update docs/src/pages/docs/api/getHangulAcronym.en.mdx
KNU-K e409273
fix : Update hangul.ts
KNU-K 4e4e5bd
Update getHangulAcronym.ko.mdx
KNU-K c6f1bc4
Update getHangulAcronym.en.mdx
KNU-K ba3ed2a
Update src/getHangulAcronym.ts
KNU-K 00b3560
Update src/getHangulAcronym.ts
KNU-K b7dd6a7
Update getHangulAcronym.ts
KNU-K a36ab58
Update getHangulAcronym.spec.ts
KNU-K 3ffcd89
Create fair-brooms-drive.md
okinawaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getHangulAcronym } from './getHangulAcronym'; | ||
|
||
describe('getHangulAcronym', () => { | ||
it('한글 문장 단어중 첫 문자만 뽑은 리스트를 반환', () => { | ||
expect(getHangulAcronym('치킨과 맥주')).toHaveLength(2); | ||
expect(getHangulAcronym('치킨과 맥주').join('')).toBe('치맥'); | ||
|
||
expect(getHangulAcronym('버스 충전 카드')).toHaveLength(3); | ||
expect(getHangulAcronym('버스 충전 카드').join('')).toBe('버충카'); | ||
}); | ||
it('한글이 아닌 문장 넣었을 때', () => { | ||
expect(() => getHangulAcronym('test test')).toThrowError('Invalid Hangul text, please input Hangul text only.'); | ||
}); | ||
|
||
it('한글과 영어가 섞인 문장을 넣었을 때', () => { | ||
expect(() => getHangulAcronym('고기와 Cheese')).toThrowError('Invalid Hangul text, please input Hangul text only.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { isHangulOnly } from './_internal/hangul'; | ||
|
||
/** | ||
* | ||
* @param getHangulAcronym | ||
* @description | ||
* 한글 문장을 입력받아서, 해당 한글 문장의 초성을을 리턴해줍니다. | ||
* 한글 문장이 아닌, 문장은 취급하지않습니다. 추가로 한글 문장 + 영어 문장의 경우에도 취급하지않습니다. | ||
*/ | ||
export function getHangulAcronym(text: string) { | ||
KNU-K marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (!isHangulOnly(text)) throw new Error('Invalid Hangul text, please input Hangul text only.'); | ||
|
||
const words = text.split(' '); | ||
|
||
const firstHangulLetters = words.map(word => word.charAt(0)); | ||
|
||
return firstHangulLetters; | ||
KNU-K marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
#136
이 PR이 머지되면, #136 에서 제공되는 메서드로 이것을 대체하는것은어떤가요?
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.
불필요해졌으니, 삭제해도 좋을 것 같아요