aamoji
v0.0.0
Published
Returns an ASCII representation for each emoji.
Downloads
139
Maintainers
Readme
aamoji
Return an ASCII representation for each emoji.
Install
npm install aamojiUsage
const aamoji = require('aamoji');
aamoji('😀'); // ':D'
aamoji('❤️'); // '<3'
aamoji('👍'); // '(b)'
aamoji('🦄'); // '(unicorn)'
// Unknown emoji returns itself by default.
aamoji('🫥'); // '🫥'
aamoji('🫥', '?'); // '?' (with fallback)
// Replace every known emoji inside a string.
aamoji.replace('hello 😀 world ❤️');
// 'hello :D world <3'
// Check whether a mapping exists.
aamoji.has('😀'); // true
// Get the full map.
aamoji.all(); // { '😀': ':D', ... }API
aamoji(emoji, fallback?)
Returns the ASCII string for emoji. If the emoji is not in the map, returns
fallback when provided, otherwise the original emoji.
aamoji.replace(str)
Replaces every known emoji in str with its ASCII equivalent. Unknown
characters are left untouched.
aamoji.has(emoji)
Returns true if the emoji has a mapping.
aamoji.all()
Returns a shallow copy of the full emoji-to-ASCII map.
aamoji.map
The underlying map object (do not mutate).
License
MIT
