hangul.dev β€” boot/init.sh

            
● readme.md
~/hangul.dev β€” bash β€” 80Γ—24
$
β†’

hangul.dev

A developer toolkit for Hangul processing, encoding, jamo decomposition, and romanization β€” engineered for the terminal, written for humans.

μ΄ˆμ„± 쀑성 μ’…μ„±

● install.md

$ install

Install via your favorite package manager. Works in Node 18+, Deno, Bun, and the browser.

shell install.sh
# npm
npm install @hangul/core

# pnpm
pnpm add @hangul/core

# deno
deno add jsr:@hangul/core
typescript quickstart.ts
import { decompose, compose } from "@hangul/core";

const jamo = decompose("ν•œκΈ€");
// β†’ ["γ…Ž","ㅏ","γ„΄","γ„±","γ…‘","γ„Ή"]

const word = compose(["γ…Ž","ㅏ","γ„΄"]);
// β†’ "ν•œ"

● decompose.md

interactive_demo()

Click a syllable to decompose it. Click again to recompose. Each jamo is colored by its role: μ΄ˆμ„± Β· 쀑성 Β· μ’…μ„±.

svg syllable_block.svg
γ…Ž ㅏ γ„΄ ν•œ choseong jungseong jongseong
decomposed

● jamo.ts

jamo()

Low-level access to the 24 base jamo and their composition rules. Map any syllable to its underlying components.

typescript jamo.ts
export function decompose(syllable: string): Jamo[] {
  const code = syllable.charCodeAt(0) - 0xAC00;
  const cho  = Math.floor(code / 588);
  const jung = Math.floor((code % 588) / 28);
  const jong = code % 28;
  return [CHO[cho], JUNG[jung], JONG[jong]].filter(Boolean);
}
μ΄ˆμ„± Β· choseong
14
γ„± γ„΄ γ„· γ„Ή ㅁ γ…‚ γ…… γ…‡ γ…ˆ γ…Š γ…‹ γ…Œ ㅍ γ…Ž
쀑성 Β· jungseong
10
ㅏ γ…‘ γ…“ γ…• γ…— γ…› γ…œ γ…  γ…‘ γ…£
μ’…μ„± Β· jongseong
7
γ„± γ„΄ γ„Ή ㅁ γ…‚ γ…‡ γ„·

● encode.ts

encode()

Convert between Unicode codepoints, KS X 1001, EUC-KR, and UTF-8 representations of any Hangul string.

shell repl.sh
$ hangul encode "ν•œκΈ€" --to=utf8
β†’ ED 95 9C EA B8 80

$ hangul encode "ν•œκΈ€" --to=euc-kr
β†’ C7 D1 B1 DB

$ hangul encode "ν•œκΈ€" --to=codepoint
β†’ U+D55C U+AE00

● romanize.ts

romanize()

Romanize Hangul text using the Revised Romanization, McCune-Reischauer, or Yale systems. Pluggable per-call.

typescript romanize.ts
import { romanize } from "@hangul/core";

romanize("μ•ˆλ…•ν•˜μ„Έμš”");
// β†’ "annyeonghaseyo"  (revised)

romanize("μ•ˆλ…•ν•˜μ„Έμš”", { system: "mr" });
// β†’ "annyŏnghaseyo"  (mccune-reischauer)

romanize("ν•œκΈ€", { system: "yale" });
// β†’ "hankul"

● syllable.md

syllable_blocks

Hangul is composed by stacking jamo into rectangular syllable blocks. Each block contains a μ΄ˆμ„± (initial), 쀑성 (medial vowel), and an optional μ’…μ„± (final).

γ…Ž + ㅏ + γ„΄ β†’ γ…Žγ…γ„΄ han
γ„± + γ…‘ + γ„Ή β†’ γ„±γ…‘γ„Ή geul
γ„΄ + ㅏ β†’ ㄴㅏ na
γ…‚ + γ…— + ㅁ β†’ ㅂㅗㅁ bom

● choseong.md

choseong_search()

Korean speakers search by initial consonants alone. Type γ„±γ„΄ and match γ„±μš΄γ„΄μ΄, γ„±μ—¬μšΈγ„΄, γ„±λ‘œγ„΄ β€” a powerful UX for Korean autocomplete.

typescript cho-search.ts
import { choMatch } from "@hangul/core";

choMatch("γ„±γ„΄", ["강남", "κ΄‘λ‚˜λ£¨", "μ’…λ‘œ"]);
// β†’ ["강남", "κ΄‘λ‚˜λ£¨"]

choMatch("γ…Žγ„±", ["ν•œκΈ€", "호수"]);
// β†’ ["ν•œκΈ€"]

● playground.md

$ playground

Type any Hangul string. Watch it decompose live, with each jamo color-coded by its role.

decomposed
romanized
utf-8
choseong