https://github.com/zmofei/emojily
transfer both text to emoji and emoji to text
https://github.com/zmofei/emojily
Last synced: 8 months ago
JSON representation
transfer both text to emoji and emoji to text
- Host: GitHub
- URL: https://github.com/zmofei/emojily
- Owner: zmofei
- License: mit
- Created: 2018-09-20T16:53:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-25T06:14:23.000Z (almost 8 years ago)
- Last Synced: 2025-03-01T06:19:30.218Z (over 1 year ago)
- Language: JavaScript
- Size: 68.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# emojily
[](https://travis-ci.com/zmofei/emojily) [](https://codecov.io/gh/zmofei/emojily) [](LICENSE) [](https://www.npmjs.com/package/emojily)
Encode/Decode engine for text to emoji
[Try it online 😛](https://zmofei.github.io/emojily/example/index.html)
# Usage
1. Install
```Javascript
npm install emojily --save
```
or use from CDN for browser
```
```
2. encode text to emoji
```javascript
const {encode} = require('emojily');
encode('hello');
// the output will be: 😎😃😜😃😙😃😠😃😠😄😁😚
// every time it wil return defferent output even you encode same word.
// eg:
// > encode('hello');
// '😋😃😙😃😖😃😝😃😝😃😠😗'
// > encode('hello');
// '😄😃😒😃😏😃😖😃😖😃😙😐'
// > encode('hello');
// '😡😃😍😃😊😃😑😃😑😃😔😋'
```
3. decode from emoji
```javascript
const {decode} = require('emojily');
decode('😋😃😙😃😖😃😝😃😝😃😠😗');
// the output will be: 'hello'
// tips: the emoji text must from encode, and you can not change any letter in the text.
// eg:
// if you are try to switch the last 2 letter 😋😃😙😃😖😃😝😃😝😃😠😗 => 😋😃😙😃😖😃😝😃😝😃😗😠
// then you tru decode('😋😃😙😃😖😃😝😃😝😃😗😠');
// it will throw an error like: 'Error Input, Please do not try to change any character'
```