A lightweight Rust library for converting between Hangul characters and their individual Jamo components (initial, medial, and final consonants/vowels), designed for efficient use in web environments via WebAssembly (Wasm).
npm install ganadala
ganadalaganadalaλ νκΈ λ¬Έμμ μλͺ¨(μ΄μ±, μ€μ±, μ’
μ±) κ°μ λ³νμ μν κ²½λ Rust λΌμ΄λΈλ¬λ¦¬λ‘, WebAssembly(Wasm)λ₯Ό ν΅ν΄ μΉ νκ²½μμλ ν¨μ¨μ μΌλ‘ μ¬μ©ν μ μμ΅λλ€.
wasm-bindgenμ μ¬μ©νμ¬ WebAssembly λͺ¨λλ‘ μ»΄νμΌλ©λλ€. λ°λΌμ JavaScript/TypeScript νλ‘μ νΈμμ npmμ ν΅ν΄ μ€μΉνμ¬ μ¬μ©ν μ μμ΅λλ€.
bash
npm install ganadala
λλ yarn
yarn add ganadala
`
$3
λ§μ½ Rust νλ‘μ νΈμμ μ§μ μ΄ λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©νκ³ μ νλ€λ©΄, Cargo.tomlμ λ€μμ μΆκ°νμΈμ.
`toml
[dependencies]
ganadala = "0.1.0" # μ΅μ λ²μ μΌλ‘ λ³κ²½νμΈμ.
`
$3
`javascript
import { is_korean, decompose, compose } from 'ganadala';
// νκΈ ν¬ν¨ μ¬λΆ νμΈ
console.log(is_korean("μλ
νμΈμ")); // true
console.log(is_korean("Hello World")); // false
// νκΈ μλͺ¨ λΆν΄
const decomposedText = decompose("μλ
νμΈμ");
console.log(decomposedText); // ["γ
", "γ
", "γ΄", "γ΄", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
"]
const decomposedComplex = decompose("λͺ«");
console.log(decomposedComplex); // ["γ
", "γ
", "γ±", "γ
"] (λ³΅ν© μ’
μ± γ³κ° γ±, γ
μΌλ‘ λΆν΄)
// νκΈ μμ μ‘°ν©
const composedText = compose(["γ
", "γ
", "γ΄", "γ΄", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
", "γ
"]);
console.log(composedText); // "μλ
νμΈμ"
const composedComplex = compose(["γ
", "γ
", "γ±", "γ
"]);
console.log(composedComplex); // "λͺ«" (γ±, γ
κ° γ³λ‘ μ‘°ν©)
`
π οΈ κ°λ°
μ΄ νλ‘μ νΈλ wasm-packμ μ¬μ©νμ¬ λΉλλ©λλ€.
`bash
wasm-pack μ€μΉ (μμ§ μ€μΉλμ§ μμλ€λ©΄)
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
νλ‘μ νΈ λΉλ
wasm-pack build --target web
`
λΉλ νμλ pkg λλ ν 리μ WebAssembly λͺ¨λκ³Ό JavaScript λ°μΈλ© νμΌμ΄ μμ±λ©λλ€.
π€ κΈ°μ¬
κΈ°μ¬λ₯Ό νμν©λλ€\! λ²κ·Έ λ³΄κ³ , κΈ°λ₯ μ μ, μ½λ κ°μ λ± μ΄λ€ ννμ κΈ°μ¬λΌλ μ’μ΅λλ€. GitHub μ μ₯μμ μ΄μλ₯Ό μμ±νκ±°λ Pull Requestλ₯Ό μ μΆν΄μ£ΌμΈμ.
π λΌμ΄μ μ€
μ΄ νλ‘μ νΈλ MIT λΌμ΄μ μ€ νμ λ°°ν¬λ©λλ€. μμΈν λ΄μ©μ LICENSE` νμΌμ μ°Έμ‘°νμΈμ.