# graphemes

> A JavaScript library to convert a string into an array of graphemes, following the Unicode 12 Text Segmentation spec

Latest version **2.0.0** (published 2019-12-10) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-12-10 |
| First published | 2019-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 56 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom Cumming |
| Maintainers | tomcumming |
| Keywords | Unicode, Graphemes |

## Links

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

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2019-12-10
- 1.0.1 — 2019-12-02
- 1.0.0 — 2019-12-02

## README

# Graphemes

## A JavaScript library to convert a string into an array of graphemes, following the Unicode 12 Text Segmentation spec

*aka Unicode® Standard Annex #29*

- Easy `String -> String[]` usage
- Also handles streaming for huge text
    - Iterator of code points in
    - Iterator of graphemes out
- Passes the Unicode 12 grapheme test suite
- Straightforward, Modern Typescript implementation
- Zero dependencies!

## Usage

```bash
npm i graphemes
```

- This code uses [Unicode property escapes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Unicode_Property_Escapes) so be sure to include `@babel/plugin-proposal-unicode-property-regex` if you plan to target Firefox and Edge. [Example here](example)

## Example

```javascript
const graphemes = require('graphemes');

const text = '각กำg̈';

console.log('Code points:', Array.from(text));
console.log('Graphemes:', graphemes.default(text));

/*
Code points: ['ᄀ', 'ᅡ', 'ᆨ','ก', 'ำ', 'g','̈']
Graphemes: [ '각', 'กำ', 'g̈' ]
*/
```

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