emoji-provider v1.0.6
emoji-provider
Adds a simple way of generating emojis to your front-end application. Do you need emojis for a chat application? Maybe you want to convert emoticons to emojis in text? Look no further! Currently supports emojis up to Unicode Version 15.
A zero-dependency library.
Installation
Install with npm:
npm install emoji-provider
ES6
import { emojiProvider } from 'emoji-provider'
Usage example
import { emojiProvider } from 'emoji-provider'
const text = 'I love emojis :D <3'
const emojiText = emojiProvider.replaceEmoticonsWithEmojis(text)
console.log(emojiText)
// => 'I love emojis ๐ โค๏ธ'
API
getEmojis()
Returns a string array with all supported emojis (currently supports emojis up to Unicode Version 15).
const emojis = getEmojis()
console.log(emojis)
/* => [
'๐', '๐', '๐', '๐', '๐', '๐
', '๐คฃ',
'๐', '๐', '๐', '๐', '๐', '๐', '๐ฅฐ',
'๐', '๐คฉ', '๐', '๐', '๐', '๐', '๐',
'๐', '๐', '๐คช', '๐', '๐ค', '๐ค', '๐คญ',
'๐คซ', '๐ค', '๐ค', '๐คจ', '๐', '๐', '๐ถ',
'๐', '๐', '๐', '๐ฌ', '๐คฅ', '๐', '๐',
'๐ช', '๐คค', '๐ด', '๐ท', '๐ค', ...
]
*/
getEmojisAndTags()
Returns an object array with all supported emojis and corresponding tags (currently supports emojis up to Unicode Version 15).
const emojiObjects = getEmojisAndTags()
console.log(emojiObjects)
/* => [
{ tag: 'happy-face', emoji: '๐' },
{ tag: 'happy-face-with-big-eyes', emoji: '๐' } ,
{ tag: 'happy-face-with-smiling-eyes', emoji: '๐' },
{ tag: 'beaming-face-with-smiling-eyes', emoji: '๐' },
{ tag: 'laughing', emoji: '๐' },
{ tag: 'happy-sweat', emoji: '๐
' },
{ tag: 'rolling-on-the-floor-laughing', emoji: '๐คฃ' },
{ tag: 'face-with-tears-of-joy', emoji: '๐' },
{ tag: 'slightly-smiling-face', emoji: '๐' },
{ tag: 'upside-down-face', emoji: '๐' },
{ tag: 'winking-face', emoji: '๐' },
{ tag: 'smiley-face', emoji: '๐' },
{ ... }
*/
getEmojisByCategory(...categories)
Returns a string array with emojis of chosen categories.
Allowed input string arguments:
- activity
- animalsAndNature
- flags
- foodAndDrink
- objects
- peopleAndBody
- smileysAndEmotion
- symbols
- travelAndPlaces
OBS! Arguments are case sensitive and need to be exact.
const emojis = getEmojisByCategory('foodAndDrink')
console.log(emojis)
/* => [
'๐', '๐', '๐', '๐', '๐', '๐', '๐', '๐ฅญ',
'๐', '๐', '๐', '๐', '๐', '๐', '๐ฅ', '๐
',
'๐ฅฅ', '๐ฅ', '๐', '๐ฅ', '๐ฅ', '๐ฝ', '๐ถ', '๐ฅ',
'๐ฅฌ', '๐ฅฆ', '๐ฅ', '๐', '๐ฅ', '๐ฅ', '๐ฅจ', '๐ฅฏ',
'๐ฅ', '๐ง', '๐', '๐', '๐ฅฉ', '๐ฅ', '๐', '๐',
'๐', '๐ญ', '๐ฅช', '๐ฎ', '๐ฏ', '๐ฅ', '๐ฅ', '๐ณ',
'๐ฅ', '๐ฒ', '๐ฅฃ', '๐ฅ', '๐ฟ', '๐ง', '๐ฅซ', '๐ฑ',
'๐', '๐', '๐', '๐', '๐', '๐', '๐ ', '๐ข',
'๐ฃ', '๐ค', '๐ฅ', '๐ฎ', '๐ก', '๐ฅ', '๐ฅ ', '๐ฅก',
'๐ฆ', '๐ง', '๐จ', '๐ฉ', ...
]
*/
getEmojisAndTagsByCategory(...categories)
Returns an object array with emojis and tags of chosen categories.
Allowed input string arguments:
- activity
- animalsAndNature
- flags
- foodAndDrink
- objects
- peopleAndBody
- smileysAndEmotion
- symbols
- travelAndPlaces
OBS! Arguments are case sensitive and need to be exact.
const emojiObjects = getEmojisObjectsByCategory('animalAndNature', 'peopleAndBody')
console.log(emojiObjects)
/* => [
{ tag: 'see-no-evil-monkey', emoji: '๐' },
{ tag: 'hear-no-evil-monkey', emoji: '๐' },
{ tag: 'speak-no-evil-monkey', emoji: '๐' },
{ tag: 'monkey-face', emoji: '๐ต' },
{ tag: 'monkey', emoji: '๐' },
{ tag: 'gorilla', emoji: '๐ฆ' },
{ tag: 'dog-face', emoji: '๐ถ' },
{ tag: 'dog', emoji: '๐' },
{ tag: 'poodle', emoji: '๐ฉ' },
{ ... }
{ tag: 'waiving-hand', emoji: '๐' },
{ tag: 'raised-back-of-hand', emoji: '๐ค' },
{ tag: 'raised-hand', emoji: 'โ' },
{ tag: 'vulcan-salute', emoji: '๐'},
{ tag: 'ok-hand', emoji: '๐' },
{ tag: 'fingers-crossed', emoji: '๐ค' },
{ tag: 'i-love-you-hand-sign', emoji: '๐ค' },
{ tag: 'heavy-metal-hand-sign', emoji: '๐ค' },
{ tag: 'call-me-hand-sign', emoji: '๐ค' },
{ ... }
]
*/
getEmojiByTag(tag)
Returns the emoji as a string.
const emoji = getEmojiByTag(piano)
console.log(emoji)
// => '๐น'
replaceEmoticonsWithEmojis(text)
Returns a new string with emoticons replaced with emojis.
const newText = replaceEmoticonsWithEmojis('Hi! :D How Are you? :)')
console.log(newText)
// => 'Hi! ๐ How Are you? ๐'
getMatchingEmojis(text)
Returns an array with emojis matching input.
const emojis = getMatchingEmojis('sad')
console.log(emojis)
// => [ '๐ข', '๐', '๐', '๐ฟ' ]
Want to contribute?
See DEVELOPER.md for project information and contribution details.