Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cezarsmpio/emojer
Smiles to emojis. Natively. Browsers and Node.js.
https://github.com/cezarsmpio/emojer
emojer emoji es2015 es6 javascript js parser
Last synced: about 2 months ago
JSON representation
Smiles to emojis. Natively. Browsers and Node.js.
- Host: GitHub
- URL: https://github.com/cezarsmpio/emojer
- Owner: cezarsmpio
- License: mit
- Created: 2017-07-07T17:34:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-19T16:26:46.000Z (over 7 years ago)
- Last Synced: 2024-09-16T04:49:54.248Z (3 months ago)
- Topics: emojer, emoji, es2015, es6, javascript, js, parser
- Language: JavaScript
- Homepage: https://cezarsmpio.github.io/emojer/
- Size: 83 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# emojer
> Smiles to emojis. Natively.
Emojer is a simple library to transform your smiles like `:)` to :smiley:.
We use the `String.fromCodePoint` method to transform char code to the emoji. Not images.
To use it, is very simple, let's take a look:
```
const rock = emojer.parse('My rock text :rock: ;P');
```The result will be: My rock text :metal: :stuck_out_tongue_winking_eye:
## Demo
* Playground: https://cezarlz.github.io/emojer/
* Chat example: https://codepen.io/CezarLuiz0/pen/xrNKwm## Install
```
npm install emojer.js --save
``````
yarn add emojer.js
```## API
#### emojer.parse(string: text)
Parse the string to the string "emojed".
Example:
```
emojer.parse('Hello guys :D');
```#### emojer.addEmoji(string: smile, number: charCode)
Add a new emoji to the list to be replaced by the charCode.
Example:
```
emojer.addEmoji("--'", 0x1f612);
```You can check the full list of emojis and their unicodes [here](http://unicode.org/emoji/charts/full-emoji-list.html).
#### emojer.setConfigs(object: newConfigs)
Emojer uses configs to do somethings, like add css classes to the emoji and a option to render the emojis with a HTML wrapper.
The default configs are:
```
{
span_classes: [],
html: true
}
```You can use it:
```
emojer.setConfigs({
span_classes: ['foo', 'bar''],
html: false
});
```By default, emojer adds the `emojer-icon` css class in every emoji rendered if the flag `html` is `true`.
## Emojis Available
```
:) :] =) =] (: [: (= [= :3 :D =D ;) ;] (H) :* :| :O :P ;P :'( :'[ )': ]': :# (A) :( :[ :@ (6) +( +[ <3 S2 (L) (8) (Y) (OK) :rock: :-) :$ ;-) :-* ;* =-O :-P :/ :-P *_* +_+ >_< O_O
```## Contributing
Just clone, yarn, `npm start`, make your magic, push and open a pull request. Voilá!
## Browser and OS Support
Check the support of native emojis [here](http://caniemoji.com/).
---
Made with :heart: