# split-graphemes

> Divide the string into graphemes.

Latest version **0.5.0** (published 2021-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install split-graphemes
pnpm add split-graphemes
yarn add split-graphemes
bun add split-graphemes
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2021-07-27 |
| First published | 2018-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Daiki Iizuka |
| Maintainers | shokai, daiiz |
| Keywords | grapheme, emoji, abugida, arabic, brahmic, bengali, devanagari, gujarati, hebrew, japanese, kannada, khmer, lao, malayalam, myanmar, NFD, tamil, telugu, thai, tibetan |

## Links

- npm: https://www.npmjs.com/package/split-graphemes
- Repository: https://github.com/nota/split-graphemes
- Homepage: https://github.com/nota/split-graphemes#readme
- Issues: https://github.com/nota/split-graphemes/issues
- npm.io page: https://npm.io/package/split-graphemes

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.5.0 (latest) — 2021-07-27
- 0.4.1 — 2021-06-18
- 0.4.0 — 2021-06-18
- 0.3.0 — 2021-06-16
- 0.2.0 — 2019-07-16
- 0.1.3 — 2019-07-16
- 0.1.2 — 2019-04-17
- 0.1.1 — 2019-03-29
- 0.0.5 — 2018-12-19
- 0.0.4 — 2018-12-18
- 0.0.3 — 2018-12-18
- 0.0.2 — 2018-12-18
- 0.0.1 — 2018-12-18

## README

# split-graphemes

Divide ligature letters such as Thai, Khmer letters and complex emoji into array of [graphemes](https://en.wikipedia.org/wiki/Grapheme).
You can simply use this library instead of `Array.from` to get graphemes.

[![CircleCI](https://circleci.com/gh/nota/split-graphemes/tree/master.svg?style=svg)](https://circleci.com/gh/nota/split-graphemes/tree/master)

## Installation
```
$ npm install split-graphemes
```

## Examples
### Emoji

```js
// An emoji '👨‍👩‍👦‍👦' consists of 4 people face emoji joined by Zero Width Joiners (ZWJ).
const chars = Array.from('👨‍👩‍👦‍👦') // ['👨', ZWJ, '👩', ZWJ, '👦', ZWJ, '👦']
```

```js
// It is interpreted exactly as one character!
const chars = splitGraphemes('👨‍👩‍👦‍👦') // ['👨‍👩‍👦‍👦']
```

### Khmer characters

```js
Array.from('ប៉ុស្ដិ៍') // ['ប', '៉', 'ុ', 'ស', '្', 'ដ', 'ិ', '៍']
```

```js
splitGraphemes('ប៉ុស្ដិ៍') // ['ប៉ុ', 'ស្ដិ៍']
```

### Japanese NFD
```js
splitGraphemes('ごん゙に゙ぢば') // ['ご', 'ん゙', 'に゙', 'ぢ', 'ば']
splitGraphemes('パピプペポ') // ['パ', 'ピ', 'プ', 'ペ', 'ポ']
```

### English
```js
splitGraphemes('Hello') // ['H', 'e', 'l', 'l', 'o']
```

## Supported ligature characters
The list of characters is at [here](https://github.com/nota/split-graphemes/tree/master/src).
- [Emoji](https://en.wikipedia.org/wiki/Unicode_block)
- [Arabic](https://www.unicode.org/charts/PDF/U0600.pdf) and [Arabic supplement](https://www.unicode.org/charts/PDF/U0750.pdf)
- [Bengali](https://www.unicode.org/charts/PDF/U0980.pdf)
- [Devanagari](https://www.unicode.org/charts/PDF/U0900.pdf)
- [Gujarati](https://www.unicode.org/charts/PDF/U0A80.pdf)
- [Hebrew](https://www.unicode.org/charts/PDF/U0590.pdf)
- [Japanese Hiragana](https://www.unicode.org/charts/PDF/U3040.pdf) and [Katakana](https://www.unicode.org/charts/PDF/U30A0.pdf) NFD
- [Kannada](https://www.unicode.org/charts/PDF/U0C80.pdf)
- [Khmer](https://www.unicode.org/charts/PDF/U1780.pdf)
- [Lao](https://www.unicode.org/charts/PDF/U0E80.pdf)
- [Malayalam](https://unicode.org/charts/PDF/U0D00.pdf)
- [Myanmar](https://www.unicode.org/charts/PDF/U1000.pdf)
- [Tamil](https://www.unicode.org/charts/PDF/U0B80.pdf)
- [Telugu](https://www.unicode.org/charts/PDF/U0C00.pdf)
- [Thai](https://www.unicode.org/charts/PDF/U0E00.pdf)
- [Tibetan](https://www.unicode.org/charts/PDF/U0F00.pdf)

---
_Source: https://npm.io/package/split-graphemes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
