Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jukben/unicode

👌 Safe work with unicode strings with emoji chars up to *Emoji 5.0* (Unicode 10.0)
https://github.com/jukben/unicode

Last synced: 17 days ago
JSON representation

👌 Safe work with unicode strings with emoji chars up to *Emoji 5.0* (Unicode 10.0)

Awesome Lists containing this project

README

        

# @jukben/unicode

![Codecov](https://codecov.io/gh/jukben/unicode/branch/master/graph/badge.svg)

Safe work with unicode strings with emoji chars up to _Emoji 5.0_ (Unicode 10.0)

## Example
screen shot 2018-04-28 at 09 23 44

[Check out RunKit 🚀](https://runkit.com/jukben/unicode-10-0-js)

## Install

`npm i --save-dev @jukben/unicode`

## Usage

```javascript
import unicode from "@jukben/unicode";

`console.log(unicode("hello ✌🏻").reverse()); // ✌🏻 olleh`;
```

### API

### `unicode(string: text)`

#### `.reverse()`

returns correctly reversed string

`console.log(unicode("hello ✌🏻").reverse()); // ✌🏻 olleh`

#### `.length`

returns correct length

`console.log(unicode("hello ✌🏻").length); // 6`

#### `.charAt(index: number)`

returns character at the index or undefined

`console.log(unicode("hello ✌🏻").charAt(6)); // ✌🏻`

#### `.hexCodeAt(index: number)`

returns hax code at the index or undefined

`console.log(unicode("hello ✌🏻").hexCodeAt(6)); // 270c-1f3fb`

#### `.chars`

returns arrays of chars

`console.log(unicode("hello ✌🏻").chars); // ["h", "e", "l", "l", "o", " ", "✌🏻"]`

## License

MIT