Emoji Parser
This is just a simple emoji parser that I built to get more experience in writing npm packages. You can view it here: simple-emoji-parser
API
This is a very light-weight package, so there's not much to it.
Emoji
| Interface
The main type that describes emojis.
The id
parameter is totally optional and is only useful for duplicates and/or where you need to manually tamper with the Emojis
array directly from the parser.
EmojiParser(emojis: Array<Emoji>)
| Class
The central class of the package - where all the magic happens.
You need to initialize the class and pass the emojis array as a variable:
;
Methods
parse(string: string, callback: (result: string) => void): void
| Parse a message that may contain emoji triggers and will return the parsed string in a callback.
parseSync(string: string): Promise<string>
| An asychronous method of the regular callback parse()
method.
Variables
You can access the emojis array through the getters & setters in EmojiParser
:
// Get all current emojis in the objectget emojis: Array<Emoji> // Replace all current emojisset emojisemoji: Array<Emoji>
Contributing
All contribution is done through the official GitHub Repository. As usual, create a branch, do your work, and make a pull request.
<3