Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/jukben/unicode
- Owner: jukben
- License: mit
- Created: 2017-09-13T17:25:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-28T07:25:58.000Z (over 6 years ago)
- Last Synced: 2024-10-12T13:26:56.256Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 101 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
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
[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