Skip to content
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: 폴더 구조를 플랫화합니다 #242

Merged
merged 4 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions src/_internal/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
export const _JASO_HANGUL_NFD = [...'각힣'.normalize('NFD')].map(char => char.charCodeAt(0)); // NFC 에 정의되지 않은 문자는 포함하지 않음

export const COMPLETE_HANGUL_START_CHARCODE = '가'.charCodeAt(0);
export const COMPLETE_HANGUL_END_CHARCODE = '힣'.charCodeAt(0);

export const NUMBER_OF_JONGSEONG = 28;
export const NUMBER_OF_JUNGSEONG = 21;

/**
* ㄱ -> 'ㄱ'
* ㄳ -> 'ㄱㅅ' 으로 나눈다.
*/
export const DISASSEMBLED_CONSONANTS_BY_CONSONANT = {
// 종성이 없는 경우 '빈' 초성으로 관리하는 것이 편리하여, 빈 문자열도 포함한다.
'': '',
ㄱ: 'ㄱ',
ㄲ: 'ㄲ',
ㄳ: 'ㄱㅅ',
ㄴ: 'ㄴ',
ㄵ: 'ㄴㅈ',
ㄶ: 'ㄴㅎ',
ㄷ: 'ㄷ',
ㄸ: 'ㄸ',
ㄹ: 'ㄹ',
ㄺ: 'ㄹㄱ',
ㄻ: 'ㄹㅁ',
ㄼ: 'ㄹㅂ',
ㄽ: 'ㄹㅅ',
ㄾ: 'ㄹㅌ',
ㄿ: 'ㄹㅍ',
ㅀ: 'ㄹㅎ',
ㅁ: 'ㅁ',
ㅂ: 'ㅂ',
ㅃ: 'ㅃ',
ㅄ: 'ㅂㅅ',
ㅅ: 'ㅅ',
ㅆ: 'ㅆ',
ㅇ: 'ㅇ',
ㅈ: 'ㅈ',
ㅉ: 'ㅉ',
ㅊ: 'ㅊ',
ㅋ: 'ㅋ',
ㅌ: 'ㅌ',
ㅍ: 'ㅍ',
ㅎ: 'ㅎ',
} as const;

export const DISASSEMBLED_VOWELS_BY_VOWEL = {
ㅏ: 'ㅏ',
ㅐ: 'ㅐ',
ㅑ: 'ㅑ',
ㅒ: 'ㅒ',
ㅓ: 'ㅓ',
ㅔ: 'ㅔ',
ㅕ: 'ㅕ',
ㅖ: 'ㅖ',
ㅗ: 'ㅗ',
ㅘ: 'ㅗㅏ',
ㅙ: 'ㅗㅐ',
ㅚ: 'ㅗㅣ',
ㅛ: 'ㅛ',
ㅜ: 'ㅜ',
ㅝ: 'ㅜㅓ',
ㅞ: 'ㅜㅔ',
ㅟ: 'ㅜㅣ',
ㅠ: 'ㅠ',
ㅡ: 'ㅡ',
ㅢ: 'ㅡㅣ',
ㅣ: 'ㅣ',
} as const;

/**
* 초성으로 올 수 있는 한글 글자
*/
export const CHOSEONGS = [
'ㄱ',
'ㄲ',
'ㄴ',
'ㄷ',
'ㄸ',
'ㄹ',
'ㅁ',
'ㅂ',
'ㅃ',
'ㅅ',
'ㅆ',
'ㅇ',
'ㅈ',
'ㅉ',
'ㅊ',
'ㅋ',
'ㅌ',
'ㅍ',
'ㅎ',
] as const;

/**
* 중성으로 올 수 있는 한글 글자
*/
export const JUNSEONGS = Object.values(DISASSEMBLED_VOWELS_BY_VOWEL);

/**
* 종성으로 올 수 있는 한글 글자
*/
export const JONGSEONGS = (
[
'',
'ㄱ',
'ㄲ',
'ㄳ',
'ㄴ',
'ㄵ',
'ㄶ',
'ㄷ',
'ㄹ',
'ㄺ',
'ㄻ',
'ㄼ',
'ㄽ',
'ㄾ',
'ㄿ',
'ㅀ',
'ㅁ',
'ㅂ',
'ㅄ',
'ㅅ',
'ㅆ',
'ㅇ',
'ㅈ',
'ㅊ',
'ㅋ',
'ㅌ',
'ㅍ',
'ㅎ',
] as const
).map(consonant => DISASSEMBLED_CONSONANTS_BY_CONSONANT[consonant]);
File renamed without changes.
1 change: 1 addition & 0 deletions src/amountToHangul/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './amountToHangul';
File renamed without changes.
4 changes: 2 additions & 2 deletions src/assemble.ts → src/assemble/assemble.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { disassemble } from './disassemble';
import { binaryAssemble } from './_internal/hangul';
import { disassemble } from '../disassemble';
import { binaryAssemble } from '../_internal/hangul';

/**
* @name assemble
Expand Down
1 change: 1 addition & 0 deletions src/assemble/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './assemble';
File renamed without changes.
4 changes: 2 additions & 2 deletions src/canBe.ts → src/canBe/canBe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasValueInReadOnlyStringList } from './_internal';
import { CHOSEONGS, JONGSEONGS, JUNSEONGS } from './constants';
import { CHOSEONGS, JONGSEONGS, JUNSEONGS } from '@/_internal/constants';
import { hasValueInReadOnlyStringList } from '../_internal';

/**
* @name canBeChoseong
Expand Down
1 change: 1 addition & 0 deletions src/canBe/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './canBe';
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { canBeChoseong, canBeJongseong, canBeJungseong } from './canBe';
import {
CHOSEONGS,
COMPLETE_HANGUL_START_CHARCODE,
DISASSEMBLED_VOWELS_BY_VOWEL,
CHOSEONGS,
JONGSEONGS,
JUNSEONGS,
} from './constants';
} from '@/_internal/constants';
import { canBeChoseong, canBeJongseong, canBeJungseong } from '../canBe';

/**
* @name combineCharacter
Expand Down
1 change: 1 addition & 0 deletions src/combineCharacter/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './combineCharacter';
Loading