Skip to content

Commit

Permalink
Merge branch 'main' into fix/docs-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
po4tion committed Jun 29, 2024
2 parents 50b6182 + f782ec2 commit 56c2af7
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 32 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# es-hangul

## 1.3.10

### Patch Changes

- [#148](https://github.com/toss/es-hangul/pull/148) [`f3c7fe9`](https://github.com/toss/es-hangul/commit/f3c7fe9f73138b932af817b8ac925d54c3283151) Thanks [@KNU-K](https://github.com/KNU-K)! - fix : getHangulacronym함수를 acronymizeHangul 메서드로 대체합니다

## 1.3.9

### Patch Changes
Expand Down
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# docs

## 0.1.6

### Patch Changes

- Updated dependencies [[`f3c7fe9`](https://github.com/toss/es-hangul/commit/f3c7fe9f73138b932af817b8ac925d54c3283151)]:
- es-hangul@1.3.10

## 0.1.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.1.5",
"version": "0.1.6",
"private": true,
"packageManager": "yarn@4.1.1",
"scripts": {
Expand Down
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(''); //버충카
```
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(''); //버충카
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es-hangul",
"version": "1.3.9",
"version": "1.3.10",
"keywords": [
"한글",
"한국어",
Expand Down
18 changes: 18 additions & 0 deletions src/acronymizeHangul.spec.ts
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');
});
});
2 changes: 1 addition & 1 deletion src/getHangulAcronym.ts → src/acronymizeHangul.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { parseHangul } from './_internal/hangul';
* 한글 문장을 입력받아서, 해당 한글 문장의 초성을을 리턴해줍니다.
* 한글 문장이 아닌, 문장은 취급하지않습니다. 추가로 한글 문장 + 영어 문장의 경우에도 취급하지않습니다.
*/
export function getHangulAcronym(hangul: string) {
export function acronymizeHangul(hangul: string) {
return parseHangul(hangul).split(' ').map(word => word.charAt(0));
}
18 changes: 0 additions & 18 deletions src/getHangulAcronym.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export * from './josa';
export * from './removeLastHangulCharacter';
export * from './utils';
export * from './extractHangul';
export * from './getHangulAcronym';
export * from './acronymizeHangul';

0 comments on commit 56c2af7

Please sign in to comment.