forked from toss/es-hangul
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix : getHangulacronym함수를 acronymizeHangul 메서드로 대체합니다. (toss#148)
* Update and rename getHangulAcronym.ts to acronymizeHangul.ts * Update and rename getHangulAcronym.spec.ts to acronymizeHangul.spec.ts * Update index.ts * Update and rename getHangulAcronym.en.mdx to acronymizeHangul.en.mdx * Update and rename getHangulAcronym.ko.mdx to acronymizeHangul.ko.mdx * Create odd-squids-sin.md --------- Co-authored-by: 박찬혁 <[email protected]>
- Loading branch information
1 parent
d716621
commit be53c6e
Showing
7 changed files
with
35 additions
and
30 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"es-hangul": patch | ||
--- | ||
|
||
fix : getHangulacronym함수를 acronymizeHangul 메서드로 대체합니다 |
10 changes: 5 additions & 5 deletions
10
...rc/pages/docs/api/getHangulAcronym.en.mdx → ...rc/pages/docs/api/acronymizeHangul.en.mdx
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# getHangulAcronym | ||
# acronymizeHangul | ||
|
||
It receives the Korean sentence and returns the first letter of that Korean sentence. | ||
(We don't deal with non-Korean sentences; we don't deal with additional Korean + English sentences.) | ||
|
||
```typescript | ||
function getHangulAcronym( | ||
function acronymizeHangul( | ||
// String consisting of plural nouns (e.g. '버스 충전', '치킨과 맥주') | ||
text: string | ||
hangul: string | ||
): boolean; | ||
``` | ||
|
||
```typescript | ||
getHangulAcronym('치킨과 맥주').join(''); //치맥 | ||
getHangulAcronym('버스 충전 카드').join(''); //버충카 | ||
acronymizeHangul('치킨과 맥주').join(''); //치맥 | ||
acronymizeHangul('버스 충전 카드').join(''); //버충카 | ||
``` |
10 changes: 5 additions & 5 deletions
10
...rc/pages/docs/api/getHangulAcronym.ko.mdx → ...rc/pages/docs/api/acronymizeHangul.ko.mdx
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# getHangulAcronym | ||
# acronymizeHangul | ||
|
||
한글 문장을 입력받아서, 해당 한글 문장의 첫글자를 리턴해줍니다. | ||
(한글 문장이 아닌, 문장은 취급하지않습니다. 추가로 한글 문장 + 영어 문장의 경우에도 취급하지않습니다.) | ||
|
||
```typescript | ||
function getHangulAcronym( | ||
function acronymizeHangul( | ||
// 복수 명사로 이루어진 문자열 (e.g. '버스 충전', '치킨과 맥주') | ||
text: string | ||
hangul: string | ||
): boolean; | ||
``` | ||
|
||
```typescript | ||
getHangulAcronym('치킨과 맥주').join(''); //치맥 | ||
getHangulAcronym('버스 충전 카드').join(''); //버충카 | ||
acronymizeHangul('치킨과 맥주').join(''); //치맥 | ||
acronymizeHangul('버스 충전 카드').join(''); //버충카 | ||
``` |
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 { acronymizeHangul } from './acronymizeHangul'; | ||
|
||
describe('acronymizeHangul', () => { | ||
it('한글 문장 단어중 첫 문자만 뽑은 리스트를 반환', () => { | ||
expect(acronymizeHangul('치킨과 맥주')).toHaveLength(2); | ||
expect(acronymizeHangul('치킨과 맥주').join('')).toBe('치맥'); | ||
|
||
expect(acronymizeHangul('버스 충전 카드')).toHaveLength(3); | ||
expect(acronymizeHangul('버스 충전 카드').join('')).toBe('버충카'); | ||
}); | ||
it('한글이 아닌 문장 넣었을 때', () => { | ||
expect(() => acronymizeHangul('test test')).toThrowError('"test test" is not a valid hangul string'); | ||
}); | ||
|
||
it('한글과 영어가 섞인 문장을 넣었을 때', () => { | ||
expect(() => acronymizeHangul('고기와 Cheese')).toThrowError('"고기와 Cheese" is not a valid hangul string'); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
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