Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heineiuo/text-parser-emoji
😁text parser for emoji
https://github.com/heineiuo/text-parser-emoji
ast emoji react text-parser
Last synced: about 18 hours ago
JSON representation
😁text parser for emoji
- Host: GitHub
- URL: https://github.com/heineiuo/text-parser-emoji
- Owner: heineiuo
- Created: 2017-03-17T09:04:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T03:43:45.000Z (over 7 years ago)
- Last Synced: 2024-08-12T00:07:40.523Z (3 months ago)
- Topics: ast, emoji, react, text-parser
- Language: JavaScript
- Homepage: https://heineiuo.github.io/text-parser-emoji
- Size: 423 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# emoji-parse
😁Parse emoji plain text to syntax tree---
*Important*: Most of code come from [banyan/react-emoji](https://github.com/banyan/react-emoji).
Instead parse to create react element, this repo return an ast-like tree for more common usage.See [Demo](https://heineiuo.github.io/emoji-parse/).
![emoji-parse](https://github.com/heineiuo/emoji-parse/raw/master/docs/screenshot.png)
## usage
* commonjs: `yarn add emoji-parse`
```javascript
import { emojifyTextToSingleEmoji, emojifyText} from 'emoji-parse'const result = emojifyText(':smile:你好,今天天气不错:sun_with_face:')
console.log(result)
//[ { type: 'emoji', value: 'smile' },
// { type: 'text', value: '你好,今天天气不错' },
// { type: 'emoji', value: 'sun_with_face' } ]```
* amd(browser):
```html
```
## options
Properties | Description | Default | Type
---|---|---|---
useEmoticon | Use emoticon or not| true | Boolean
strict | Throw an error if annotation is not in dict, it's handy if emoji input is not from end user | false | Boolean### Test
```
$ npm test
```## License
MIT