Skip to content

Commit

Permalink
feat: 폴더 구조를 플랫화합니다 (#242)
Browse files Browse the repository at this point in the history
* 폴더 구조 플랫화

* 폴더 경로 수정

* constant 파일 분리

* vitest absoulte path
  • Loading branch information
okinawaa committed Sep 6, 2024
1 parent 6d684b6 commit dc0bb4b
Show file tree
Hide file tree
Showing 57 changed files with 547 additions and 562 deletions.
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.
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';
File renamed without changes.
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

0 comments on commit dc0bb4b

Please sign in to comment.