From e5a4c7ae14d3af2e78cffa730d38b0d7784c8312 Mon Sep 17 00:00:00 2001 From: taehyun <126179088+KNU-K@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:06:20 +0900 Subject: [PATCH 1/6] Update and rename getHangulAcronym.ts to acronymizeHangul.ts --- src/{getHangulAcronym.ts => acronymizeHangul.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/{getHangulAcronym.ts => acronymizeHangul.ts} (89%) diff --git a/src/getHangulAcronym.ts b/src/acronymizeHangul.ts similarity index 89% rename from src/getHangulAcronym.ts rename to src/acronymizeHangul.ts index 5e5c5a37..9103ec40 100644 --- a/src/getHangulAcronym.ts +++ b/src/acronymizeHangul.ts @@ -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)); } From 5279cae787daa27b23df99fd1c880ed739ea587d Mon Sep 17 00:00:00 2001 From: taehyun <126179088+KNU-K@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:06:51 +0900 Subject: [PATCH 2/6] Update and rename getHangulAcronym.spec.ts to acronymizeHangul.spec.ts --- src/acronymizeHangul.spec.ts | 18 ++++++++++++++++++ src/getHangulAcronym.spec.ts | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 src/acronymizeHangul.spec.ts delete mode 100644 src/getHangulAcronym.spec.ts diff --git a/src/acronymizeHangul.spec.ts b/src/acronymizeHangul.spec.ts new file mode 100644 index 00000000..a4d8b91e --- /dev/null +++ b/src/acronymizeHangul.spec.ts @@ -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'); + }); +}); diff --git a/src/getHangulAcronym.spec.ts b/src/getHangulAcronym.spec.ts deleted file mode 100644 index 649d2432..00000000 --- a/src/getHangulAcronym.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -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('"test test" is not a valid hangul string'); - }); - - it('한글과 영어가 섞인 문장을 넣었을 때', () => { - expect(() => getHangulAcronym('고기와 Cheese')).toThrowError('"고기와 Cheese" is not a valid hangul string'); - }); -}); From e81825416ef7dbf3d33f01a7a4a563a84208dcea Mon Sep 17 00:00:00 2001 From: taehyun <126179088+KNU-K@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:07:05 +0900 Subject: [PATCH 3/6] Update index.ts --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 7bff5341..ee3becfd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,4 +9,4 @@ export * from './josa'; export * from './removeLastHangulCharacter'; export * from './utils'; export * from './extractHangul'; -export * from './getHangulAcronym'; +export * from './acronymizeHangul'; From 7389132415a19d5ebb4850aede05a8083b112826 Mon Sep 17 00:00:00 2001 From: taehyun <126179088+KNU-K@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:07:56 +0900 Subject: [PATCH 4/6] Update and rename getHangulAcronym.en.mdx to acronymizeHangul.en.mdx --- ...getHangulAcronym.en.mdx => acronymizeHangul.en.mdx} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename docs/src/pages/docs/api/{getHangulAcronym.en.mdx => acronymizeHangul.en.mdx} (63%) diff --git a/docs/src/pages/docs/api/getHangulAcronym.en.mdx b/docs/src/pages/docs/api/acronymizeHangul.en.mdx similarity index 63% rename from docs/src/pages/docs/api/getHangulAcronym.en.mdx rename to docs/src/pages/docs/api/acronymizeHangul.en.mdx index 730ea88c..57d026c9 100644 --- a/docs/src/pages/docs/api/getHangulAcronym.en.mdx +++ b/docs/src/pages/docs/api/acronymizeHangul.en.mdx @@ -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(''); //버충카 ``` From ca99aa772725a8e2be33f23ceb5fab1606190195 Mon Sep 17 00:00:00 2001 From: taehyun <126179088+KNU-K@users.noreply.github.com> Date: Sun, 30 Jun 2024 00:08:21 +0900 Subject: [PATCH 5/6] Update and rename getHangulAcronym.ko.mdx to acronymizeHangul.ko.mdx --- ...getHangulAcronym.ko.mdx => acronymizeHangul.ko.mdx} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename docs/src/pages/docs/api/{getHangulAcronym.ko.mdx => acronymizeHangul.ko.mdx} (67%) diff --git a/docs/src/pages/docs/api/getHangulAcronym.ko.mdx b/docs/src/pages/docs/api/acronymizeHangul.ko.mdx similarity index 67% rename from docs/src/pages/docs/api/getHangulAcronym.ko.mdx rename to docs/src/pages/docs/api/acronymizeHangul.ko.mdx index 8d655e54..908e5251 100644 --- a/docs/src/pages/docs/api/getHangulAcronym.ko.mdx +++ b/docs/src/pages/docs/api/acronymizeHangul.ko.mdx @@ -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(''); //버충카 ``` From 8296cf62c4b5513407ea914da1087170603d3af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=B0=AC=ED=98=81?= Date: Sun, 30 Jun 2024 00:13:27 +0900 Subject: [PATCH 6/6] Create odd-squids-sin.md --- .changeset/odd-squids-sin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/odd-squids-sin.md diff --git a/.changeset/odd-squids-sin.md b/.changeset/odd-squids-sin.md new file mode 100644 index 00000000..433b216b --- /dev/null +++ b/.changeset/odd-squids-sin.md @@ -0,0 +1,5 @@ +--- +"es-hangul": patch +--- + +fix : getHangulacronym함수를 acronymizeHangul 메서드로 대체합니다