
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Jamomatic
A library dedicated to working with the Korean alphabet, Hangul.
⚠️ This library is still under development and breaking changes may be many until a v1.0.0 version is released. Use with caution.
🥲 Unfortunately, after many attempts, the package name
hangul, despite being squatted on, is not being released by NPM. This project is now namedjamomatic.
npm install jamomatic
This package comes with many useful functions, and more to come!
Checks if the given search string exists at the end of the given operation string.
function endsWith(
str: string,
options?: {
decouple: boolean
}
): boolean
| Name | Default Value | Description |
|---|---|---|
| decouple | true | Decouples the composite letters before performing the search |
endsWith("한글", "글") // true
endsWith("한글", "ㅡㄹ") // true
endsWith("한글", "한") // false
endsWith("늙다", "ㄱ다") // true
endsWith("늙다", "ㄱ다", { decouple: false }) // false
Extracts the final letter from the given Hangul syllable block.
function getFinal(
str: string,
options?: {
compatibility: boolean
}
): string
| Name | Default Value | Description |
|---|---|---|
| compatibility | true | Converts the final letter into its compatibility form |
getFinal("한") // "ㄴ"
getFinal("한", { compatibility: false }) // "ᆫ"
getFinal("하") // ""
Extracts the initial letter from the given Hangul syllable block.
function getInitial(
str: string,
options?: {
compatibility: boolean
}
): string
| Name | Default Value | Description |
|---|---|---|
| compatibility | true | Converts the initial letter into its compatibility form |
getInitial("한") // "ㅎ"
getInitial("한", { compatibility: false }) // "ᄒ"
Extracts the medial letter from the given Hangul syllable block.
function getMedial(
str: string,
options?: {
compatibility: boolean
}
): string
| Name | Default Value | Description |
|---|---|---|
| compatibility | true | Converts the medial letter into its compatibility form |
getMedial("한") // "ㅏ"
getMedial("한", { compatibility: false }) // "ᅡ"
Checks if the given value is an aspirated consonant.
function isAspirated(value: unknown): boolean
isAspirated("ㅋ") // true
isAspirated("ㄱ") // false
Checks if the given value is a compatibility letter.
function isCompatibility(value: unknown): boolean
isCompatibility("ㄱ") // true
isCompatibility("ᄀ") // false
Checks if the given value is a consonant cluster, a cluster of two consonants as one letter.
function isCompositeConsonant(value: unknown): boolean
isCompositeConsonant("ㄳ") // true
isCompositeConsonant("ㄱ") // false
➡️ isDiphthong
Checks if the given value is a diphthong, a cluster of two vowels as one letter.
function isCompositeVowel(value: unknown): boolean
isCompositeVowel("ㅘ") // true
isCompositeVowel("ㅏ") // false
Checks if the given value is consonant.
function isConsonant(value: unknown): boolean
isConsonant("ㄱ") // true
isConsonant("ㅏ") // false
Checks if the given value is a consonant cluster, a cluster of two consonants as one letter.
function isConsonantCluster(value: unknown): boolean
isConsonantCluster("ㄳ") // true
isConsonantCluster("ㄱ") // false
Checks if the given value is a diphthong, a cluster of two vowels as one letter.
function isDiphthong(value: unknown): boolean
isDiphthong("ㅘ") // true
isDiphthong("ㅏ") // false
Checks if the given value is a double consonant, a cluster of two identical consonants as one letter.
function isDoubleConsonant(value: unknown): boolean
isDoubleConsonant("ㄲ") // true
isDoubleConsonant("ㄳ") // false
Checks if the given value is a non-compatibility, final consonant.
function isFinal(value: unknown): boolean
isFinal("ᆨ") // true
isFinal("ㄱ") // false
Checks if the given value is a fortis (tensed) consonant.
function isFortis(value: unknown): boolean
isFortis("ㄲ") // true
isFortis("ㄱ") // false
Checks if the given value is some sort of Hangul characters, either a loose letter or a syllable block. By default, symbols and numbers are allowed to pass. Use the options.strict boolean to disallow this behavior.
function isHangul(
value: unknown,
options?: {
strict: boolean
}
): boolean
| Name | Default Value | Description |
|---|---|---|
| strict | false | Disallows symbols and numbers from being considered valid Hangul characters |
isHangul("안녕하세요!") // true
isHangul("안녕하세요!", { strict: true }) // false
Checks if the given value is a non-compatibility, initial consonant.
function isInitial(value: unknown): boolean
isInitial("ᄀ") // true
isInitial("ㄱ") // false
Checks if the given value is an iotized vowel, one that begins with the /j/ phoneme.
function isIotized(value: unknown): boolean
isIotized("ㅑ") // true
isIotized("ㅏ") // false
Checks if the given value is a lenis (soft) consonant.
function isLenis(value: unknown): boolean
isLenis("ㄱ") // true
isLenis("ㄲ") // false
Checks if the given value is a non-compatibility, medial vowel.
function isMedial(value: unknown): boolean
isMedial("ᅡ") // true
isMedial("ㅏ") // false
Checks if the given value is a non-compatibility letter.
function isNonCompatibility(value: unknown): boolean
isNonCompatibility("ᅡ") // true
isNonCompatibility("ㅏ") // false
Checks if the given value is a Hangul syllable block.
function isSyllable(value: unknown): boolean
isSyllable("한") // true
isSyllable("ㅎ") // false
Checks if the given value is a vowel.
function isVowel
isVowel("ㅏ") // true
isVowel("ㄱ") // false
Joins the given string in a way that would resemble dubeolsik (두벌식) typing. Converts all non-compatibility letters to compatibility letters during this process.
options.split is an important consideration as it could drastically change the output. When true, this function will deconstruct all valid syllable blocks, then evaluate each individual letter as if they were typed separately. When false, however, each syllable block will be parsed as-is. See the examples for an illustration of what this actually looks like.
function join(
str: string,
options?: {
split: boolean
}
): string
| Name | Default Value | Description |
|---|---|---|
| split | true | Splits the string before parsing |
join("ㅎㅏㄴ") // 한
join("ㄱ가") // 까
join("ㄱ가", { split: false }) // ㄱ가
Splits the given string, deconstructing all of the hangul syllables into their constituent letters.
function split(
str: string,
options?: {
group: boolean
decouple: boolean
compatibility: boolean
}
): string[] | string[][]
| Name | Default Value | Description |
|---|---|---|
| group | false | Groups each syllable/grapheme into its own array |
| decouple | false | Decomposes composite letters into their constituent letters |
| compatibility | true | Converts all letters from non-compatibility letters to compatibility letters |
split("하다") // ["ㅎ", "ㅏ", "ㄷ", "ㅏ"]
split("했다") // ["ㅎ", "ㅐ", "ㅆ", "ㄷ", "ㅏ"]
split("했다", { decouple: true, compatibility: false }) // ["ᄒ", "ᅢ", "ᆺ", "ᆺ", "ᄃ", "ᅡ"]
Checks if the given search string exists at the beginning of the given operation string.
function startsWith(
str: string,
options?: {
decouple: boolean
}
): boolean
| Name | Default Value | Description |
|---|---|---|
| decouple | true | Decouples the composite letters before performing the search |
startsWith("한글", "한") // true
startsWith("한글", "ㅎㅏ") // true
startsWith("한글", "글") // false
startsWith("늙다", "늘") // true
startsWith("늙다", "늘", { decouple: false }) // false
Converts all consonants into their aspirated form.
function toAspirated(str: string): string
toAspirated("ㄱ") // "ㅋ"
toAspirated("ㄲ") // "ㅋ"
toAspirated("한국") // "한쿸"
Converts all letters into their compatibility form.
function toCompatibility(str: string): string
toCompatibility("ᆨ") // "ㄱ"
toCompatibility("ᆩ") // "ㄲ"
Converts all consonants into their double consonant form.
function toDouble(str: string): string
toDouble("ㄱ") // "ㄱ"
toDouble("ㄲ") // "ㄱ"
toDouble("가") // "까"
Converts all consonants into their final form.
function toFinal(str: string): string
toFinal("ㄱ") // "ᆨ"
toFinal("ㄲ") // "ᆩ"
Converts all consonants into their fortis (tensed) form.
function toFortis(str: string): string
toFortis("ㄱ") // "ㄲ"
toFortis("ㄲ") // "ㄲ"
toFortis("한국") // "한꾺"
Converts all consonants into their initial form.
function toInitial(str: string): string
toInitial("ㄱ") // "ᄀ"
toInitial("ㄲ") // "ᄁ"
Converts all vowels that can be iotized within the given string.
function toIotized(str: string): string
toIotized("ㅏ") // "ㅑ"
toIotized("한국") // "햔귝"
Converts all consonants into their lenis (soft) form.
function toLenis(str: string): string
toLenis("ㄱ") // "ㅋ"
toLenis("ㄲ") // "ㅋ"
toLenis("한국") // "한쿸"
Converts all vowels into their medial form.
function toMedial(str: string): string
toMedial("ㅏ") // "ᅡ"
toMedial("ㅔ") // "ᅦ"
Converts all consonants into their single consonant form.
function toSingle(str: string): string
toSingle("ㄱ") // "ㄱ"
toSingle("ㄲ") // "ㄱ"
toSingle("까") // "가"
©️ 2024 Jacob Lockett
FAQs
A library dedicated to working with the Korean alphabet, Hangul.
We found that jamomatic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.