hangulx
Version:
Providing various utilities for Hangul
146 lines (145 loc) • 7.48 kB
TypeScript
export declare class Hangul {
/**
* 주어진 charCode가 한글 범위에 속하는지 확인합니다. 자음, 모음 등과 같이 완성된 한글이 아닌 것도 포함됩니다.
*
* Checks if the given charCode falls within the range of Hangul characters, including consonants, vowels, and incomplete Hangul characters.
*
* @param charCode - 검사할 문자 코드 (String.charCodeAt()의 반환값)
* @param charCode - The character code to check (as returned by String.charCodeAt())
* @returns 한글 범위에 속하면 true, 아니면 false
* @returns true if the charCode is within the Hangul range, otherwise false
*/
static isHangulCharCode(charCode: number | null | undefined): boolean;
/**
* 주어진 문자가 한글인지 확인합니다. 자음, 모음 등과 같이 완성된 한글이 아닌 것도 포함됩니다. 문자열이 제공될 경우 첫 문자로 판단합니다.
*
* Checks if the given character is a Hangul character, including consonants, vowels, and incomplete Hangul. If a string is provided, it checks the first character.
*
* @param char - 검사할 단일 문자
* @param char - The single character to check
* @returns 한글이면 true, 아니면 false
* @returns true if the character is a Hangul, otherwise false
*/
static isHangul(char: string): boolean;
/**
* 주어진 문자열의 모든 문자가 한글인지 확인합니다. 자음, 모음 등과 같이 완성된 한글이 아닌 것도 포함됩니다.
*
* Checks if all characters in the given string are Hangul, including consonants, vowels, and incomplete Hangul.
*
* @param str - 검사할 문자열
* @param str - The string to check
* @returns 문자열의 모든 문자가 한글이면 true, 아니면 false
* @returns true if all characters in the string are Hangul, otherwise false
*/
static isHangulAll(str: string): boolean;
/**
* 주어진 문자열에 하나 이상의 한글이 포함되어 있는지 확인합니다. 자음, 모음 등과 같이 완성된 한글이 아닌 것도 포함됩니다.
*
* Checks if the given string contains at least one Hangul character, including consonants, vowels, and incomplete Hangul.
*
* @param str - 검사할 문자열
* @param str - The string to check
* @returns 한글이 하나라도 있으면 true, 없으면 false
* @returns true if there is at least one Hangul character, otherwise false
*/
static hasHangul(str: string): boolean;
/**
* 주어진 charCode가 완성된 한글 범위에 속하는지 확인합니다.
*
* Checks if the given charCode falls within the range of complete Korean syllables.
*
* @param charCode - 검사할 문자 코드 (String.charCodeAt()의 반환값)
* @param charCode - The character code to check (as returned by String.charCodeAt())
* @returns 완성된 한글이면 true, 아니면 false
* @returns true if the charCode is a complete Korean syllable, otherwise false
*/
static isCompleteCharCode(charCode: number | null | undefined): boolean;
/**
* 주어진 문자가 완성된 한글인지 확인합니다.
*
* Checks if the given character is a complete Korean syllable.
*
* @param char - 검사할 단일 문자
* @param char - The single character to check
* @returns 완성된 한글이면 true, 아니면 false
* @returns true if the character is a complete Korean syllable, otherwise false
*/
static isComplete(char: string): boolean;
/**
* 주어진 문자열의 모든 문자가 완성된 한글인지 확인합니다.
*
* Checks if all characters in the given string are complete Korean syllables.
*
* @param str - 검사할 문자열
* @param str - The string to check
* @returns 문자열의 모든 문자가 완성된 한글이면 true, 아니면 false
* @returns true if all characters in the string are complete Korean syllables, otherwise false
*/
static isCompleteAll(str: string): boolean;
/**
* 주어진 문자열에 하나 이상의 완성된 한글이 포함되어 있는지 확인합니다.
*
* Checks if the given string contains at least one complete Korean syllable.
*
* @param str - 검사할 문자열
* @param str - The string to check
* @returns 완성된 한글이 하나라도 있으면 true, 아니면 false
* @returns true if there is at least one complete Korean syllable, otherwise false
*/
static hasComplete(str: string): boolean;
private static disassembleFromChar;
/**
* 주어진 문자열을 자모로 분리합니다. 옵션을 통해 쌍자음과 복합자음의 분리 여부를 설정할 수 있습니다.
*
* Disassembles the given string into its individual Hangul components (jamo).
* The option allows control over whether to split double consonants and cluster consonants.
*
* @param str - 분리할 문자열
* @param str - The string to disassemble
* @param option - 분리 옵션 (쌍자음, 복합자음 분리 여부 설정)
* @param option - The disassembly option (controls splitting of double and cluster consonants)
* @returns 자모로 분리된 문자열 배열
* @returns An array of strings representing the disassembled jamo characters
*/
static disassemble(str: string, option?: Hangul.DisassembleOption): string[];
static disassembleToGroup(str: string, option?: Hangul.DisassembleOption): string[][];
/**
* 주어진 문자열을 자모로 분리합니다. 옵션을 통해 쌍자음과 복합자음의 분리 여부를 설정할 수 있습니다.
*
* Disassembles the given string into its individual Hangul components (jamo).
* The option allows control over whether to split double consonants and cluster consonants.
*
* @param str - 분리할 문자열
* @param str - The string to disassemble
* @param option - 분리 옵션 (쌍자음, 복합자음 분리 여부 설정)
* @param option - The disassembly option (controls splitting of double and cluster consonants)
* @returns 자모로 분리된 문자열
* @returns strings representing the disassembled jamo characters
*/
static disassembleToString(str: string, option?: Hangul.DisassembleToStringOption): string;
/**
* 랜덤한 완성형 한글을 지정한 길이만큼 생성합니다.
*
* Generates a random string of complete Hangul characters with the specified length.
*
* @param length 생성할 문자열의 길이를 지정
* @param length Specifies the length of the string to be generated
* @returns 지정된 길이만큼 랜덤하게 생성된 문자열
* @returns A randomly generated string of Hangul characters of the specified length
*/
static randomComplete(length?: number): string;
}
export declare namespace Hangul {
interface ToStringOption {
separator?: string | undefined;
}
interface DisassembleOption {
doubleConsonant?: boolean;
clusterConsonant?: boolean;
risingJDiphthong?: boolean;
risingWDiphthong?: boolean;
fallingDiphthong?: boolean;
}
interface DisassembleToStringOption extends DisassembleOption, ToStringOption {
}
}