split-graphemes
Divide ligature letters, such as Thai, Khmer letters and some emoji, that deform or combine glyphs depending on the position of characters into the minimum unit parts, graphemes.
It can also be used for strings containing characters other than ligatures, like alphabets and Japanese.
Installation
$ npm install split-graphemes
Usage
Use splitGraphemes(str)
instead of Array.from(str)
to separate character strings into character units.
Examples
Emoji
const chars = Array.from('👨👩👦👦')
const chars = splitGraphemes('👨👩👦👦')
Khmer characters
const chars = Array.from('ប៉ុស្ដិ៍')
const chars = splitGraphemes('ប៉ុស្ដិ៍')
Supported ligature characters
The list of characters is at here.