easy-emoji-translator
v1.0.0
Published
Translate your emoji -> text and text -> emoji
Downloads
2
Readme
Easy Emoji Translator
Translate your emoji -> text and text -> emoji
Install
$ npm i -s easy-emoji-translator
Example
const emojiTranslator = require('./index');
(async () => {
...
emojiTranslator.setLanguage('en-US');
const text = emojiTranslator.toText('🍌');
if (null !== text) {
console.log(text.shortName);
}
...
})();
Usage
Include
const emojiTranslator = require('./index');
Set Language
Two languages are available - ru-RU and en-US
emojiTranslator.setLanguage('ru-RU');
Emoji to text
const text = emojiTranslator.toText('👥');
console.log(text); // { emoji: '👥', shortName: 'бюсты в силуэте' }
Text to emoji
const emoji = emojiTranslator.toEmoji('Банан');
console.log(emoji); // { emoji: '🍌', shortName: 'банан' }
Other
const contains = emojiTranslator.textContains('сердце с');
console.log(contains);
const containsRegExp = emojiTranslator.textContains(/ый квадрат/i);
console.log(containsRegExp);