It allows you to search for simple Korean characters in the most consistent order regardless of the character assembly order.
npm i hangul-search-js
import { createSearch } from 'hangul-search-js'
const search = createSearch([
'λ‘―λ°μλ€λ§',
'μ νλΈ',
'νλ‘κ²μ΄λ¨Έ',
'κ°λ',
'λκ°'
])
const result = search('μγ΄')
// result: ['λ‘―λ°μλ€λ§', 'νλ‘κ²μ΄λ¨Έ', 'κ°λ', 'λκ°']
const resultExact = search('μγ΄', { exact: true })
// result: ['λ‘―λ°μλ€λ§']
const resultExact = search('λκ°', { exact: true, order: true })
// result: ['λκ°']
<script src="https://cdn.jsdelivr.net/npm/hangul-search-js/export/hangul-search.js"></script>
var createSearch = window.hangulSearch
var search = createSearch([
'λ‘―λ°μλ€λ§',
'μ νλΈ',
'νλ‘κ²μ΄λ¨Έ',
'κ°λ',
'λκ°'
])
var result = search('μγ΄')
// result: ['λ‘―λ°μλ€λ§', 'νλ‘κ²μ΄λ¨Έ', 'κ°λ', 'λκ°']
var resultExact = search('μγ΄', { exact: true })
// result: ['λ‘―λ°μλ€λ§']
var resultExact = search('λκ°', { exact: true, order: true })
// result: ['λκ°']
MIT Licensed.