@jukben/unicode

1.0.0 • Public • Published

@jukben/unicode

Codecov

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

Install

npm i --save-dev @jukben/unicode

Usage

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

Readme

Keywords

Package Sidebar

Install

npm i @jukben/unicode

Weekly Downloads

474

Version

1.0.0

License

MIT

Unpacked Size

10.9 kB

Total Files

11

Last publish

Collaborators

  • jukben