A modern JavaScript Hangul library

💡

es-hangul is a library that provides an interface for complex Hangul (Korean script) string processing. It allows for searching initial consonants and attaching particles.

import { getChoseong } from 'es-hangul';
 
const searchWord = '라면';
const userInput = 'ㄹㅁ';
 
const result = getChoseong(searchWord); // ㄹㅁ
 
// Check if the 'choseong' of the search word match the user input
if(result === userInput){
  something()
}
import { josa } from 'es-hangul';
 
const word1 = '사과';
const sentence1 = josa(word1, '을/를') + ' 먹었습니다.';
console.log(sentence1); // '사과를 먹었습니다.'
 
const word2 = '바나나';
const sentence2 = josa(word2, '이/가') + ' 맛있습니다.';
console.log(sentence2); // '바나나가 맛있습니다.'