
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
split-graphemes
Advanced tools
Divide ligature letters such as Thai, Khmer letters and complex emoji into array of graphemes.
You can simply use this library instead of Array.from
to get graphemes.
$ npm install split-graphemes
// An emoji '๐จโ๐ฉโ๐ฆโ๐ฆ' consists of 4 people face emoji joined by Zero Width Joiners (ZWJ).
const chars = Array.from('๐จโ๐ฉโ๐ฆโ๐ฆ') // ['๐จ', ZWJ, '๐ฉ', ZWJ, '๐ฆ', ZWJ, '๐ฆ']
// It is interpreted exactly as one character!
const chars = splitGraphemes('๐จโ๐ฉโ๐ฆโ๐ฆ') // ['๐จโ๐ฉโ๐ฆโ๐ฆ']
Array.from('แแแปแแแแทแ') // ['แ', 'แ', 'แป', 'แ', 'แ', 'แ', 'แท', 'แ']
splitGraphemes('แแแปแแแแทแ') // ['แแแป', 'แแแแทแ']
splitGraphemes('ใใใใใซใใกใใฏใ') // ['ใใ', 'ใใ', 'ใซใ', 'ใกใ', 'ใฏใ']
splitGraphemes('ใใใใใใใใใใ') // ['ใใ', 'ใใ', 'ใใ', 'ใใ', 'ใใ']
splitGraphemes('Hello') // ['H', 'e', 'l', 'l', 'o']
The list of characters is at here.
FAQs
Divide the string into graphemes.
The npm package split-graphemes receives a total of 9,279 weekly downloads. As such, split-graphemes popularity was classified as popular.
We found that split-graphemes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.