Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
node-emoji
Advanced tools
The node-emoji package provides a simple way to add Unicode emoji support to your Node.js applications. It allows you to easily include emoji characters in your strings and manipulate them as needed.
Get emoji by name
Retrieve an emoji character using its name (alias).
const emoji = require('node-emoji');
console.log(emoji.get('coffee')); // outputs the coffee emoji
Find emoji in a string
Search for and return information about an emoji within a string.
const emoji = require('node-emoji');
console.log(emoji.find('I :heart: node-emoji!')); // finds and returns the heart emoji object
Replace emoji names with characters in a string
Convert emoji aliases in a string to their corresponding emoji characters.
const emoji = require('node-emoji');
console.log(emoji.emojify('I :heart: node-emoji!')); // replaces the :heart: alias with the actual heart emoji character
Replace characters with emoji names in a string
Convert emoji characters in a string to their corresponding emoji aliases.
const emoji = require('node-emoji');
console.log(emoji.unemojify('I ❤️ node-emoji!')); // replaces the heart emoji character with its alias :heart:
Random emoji
Get a random emoji object, which includes the emoji character and its alias.
const emoji = require('node-emoji');
console.log(emoji.random()); // returns a random emoji object
Emojione is a package that provides emoji conversion and supports a wide range of emoji characters. It is similar to node-emoji but also includes additional features such as emoji shortcodes, ASCII conversions, and sprite generation.
Emoji-js is a package that allows for conversion between Unicode characters and emoji images. It differs from node-emoji in that it can convert emoji characters into images, which can be useful for web applications that need to support a wide range of devices and platforms.
Twemoji is a Twitter open-source project that provides emoji support across different platforms. It offers emoji parsing and image conversion, similar to emoji-js, and focuses on consistent emoji rendering across all platforms.
simple emoji support for node.js projects
To install node-emoji
, you need node.js and npm. :rocket:
Once you have that set-up, just run npm install --save node-emoji
in your project directory. :ship:
You're now ready to use emoji in your node projects! Awesome! :metal:
var emoji = require('node-emoji');
console.log(emoji.get('coffee')); // returns the emoji code for coffee (displays emoji on terminals that support it)
console.log(emoji.which(emoji.get('coffee'))); // returns the string "coffee"
console.log(emoji.get(':fast_forward:')); // `.get` also supports github flavored markdown emoji (http://www.emoji-cheat-sheet.com/)
console.log(emoji.emojify('I :heart: :coffee:!')); // replaces all :emoji: with the actual emoji, in this case: returns "I ❤️ ☕️!"
Emoji come from js-emoji (Thanks a lot :thumbsup:). You can get a JSON file with all emoji here: https://github.com/omnidan/node-emoji/blob/master/lib/emoji.json
To update the list or add custom emoji, clone this repository and put them into lib/emojifile.js
.
Then run npm run-script emojiparse
in the project directory or node emojiparse
in the lib directory.
This should generate the new emoji.json file and output Done.
.
That's all, you now have more emoji you can use! :clap:
If you want to support node-emoji development, please consider donating (it helps me keeping my projects active and alive!):
FAQs
Friendly emoji lookups and parsing utilities for Node.js. 💖
We found that node-emoji demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.