Convert Figma logo to code with AI

omnidan logonode-emoji

šŸ’– simple emoji support for node.js projects

1,306
240
1,306
22

Top Related Projects

Easy to parse data and spritesheets for emoji

2,239

:love_letter: Find the emoji that echoes your mind.

16,805

Emoji for everyone. https://twemoji.twitter.com/

šŸŖ One component to pick them all

2,363

Find relevant emoji from text on the command-line :open_mouth: :sparkles: :raised_hands: :horse: :boom: :see_no_evil:

Quick Overview

node-emoji is a simple and lightweight library for working with emoji in Node.js. It provides an easy way to convert emoji names to their corresponding Unicode characters and vice versa, as well as search for emoji by name or keyword.

Pros

  • Simple and easy to use API
  • Supports a wide range of emoji, including newer additions
  • Lightweight with no external dependencies
  • Includes search functionality for finding emoji by name or keyword

Cons

  • Limited to text-based emoji representation (no image support)
  • May not always have the most up-to-date emoji database
  • Lacks advanced features like categorization or metadata

Code Examples

  1. Converting emoji names to Unicode characters:
const emoji = require('node-emoji');

console.log(emoji.get('coffee')); // ā˜•
console.log(emoji.get('heart')); // ā¤ļø
  1. Converting Unicode characters to emoji names:
const emoji = require('node-emoji');

console.log(emoji.which('šŸ•')); // pizza
console.log(emoji.which('šŸ¶')); // dog
  1. Searching for emoji by keyword:
const emoji = require('node-emoji');

console.log(emoji.search('happy')); 
// [ { emoji: 'šŸ˜Š', key: 'blush' },
//   { emoji: 'šŸ˜ƒ', key: 'smiley' },
//   { emoji: 'šŸ˜„', key: 'smile' },
//   ... ]
  1. Replacing emoji names in a string with Unicode characters:
const emoji = require('node-emoji');

const text = 'I :heart: :coffee:!';
console.log(emoji.emojify(text)); // I ā¤ļø ā˜•!

Getting Started

To use node-emoji in your project, follow these steps:

  1. Install the package using npm:

    npm install node-emoji
    
  2. Import the library in your JavaScript file:

    const emoji = require('node-emoji');
    
  3. Start using the emoji functions:

    console.log(emoji.get('rocket')); // šŸš€
    console.log(emoji.random().emoji); // Random emoji
    

Competitor Comparisons

Easy to parse data and spritesheets for emoji

Pros of emoji-data

  • More comprehensive emoji dataset, including metadata and image assets
  • Regular updates to keep up with new emoji releases
  • Supports multiple image formats (PNG, SVG) and sizes

Cons of emoji-data

  • Larger file size due to included image assets
  • Requires more setup and configuration for basic usage
  • Not specifically designed for Node.js, may need additional integration work

Code Comparison

emoji-data:

const emojiData = require('emoji-data');
const emoji = emojiData.find_by_short_name('smile');
console.log(emoji.unified);

node-emoji:

const emoji = require('node-emoji');
console.log(emoji.get('smile'));

Key Differences

node-emoji is a lightweight Node.js-specific library focused on simple emoji operations, while emoji-data is a more comprehensive dataset that can be used across various platforms and languages. node-emoji provides easy-to-use functions for basic emoji handling, whereas emoji-data offers more detailed information and assets but requires additional setup.

emoji-data is better suited for projects requiring extensive emoji data, multiple image formats, or cross-platform compatibility. node-emoji is ideal for Node.js projects needing quick and simple emoji functionality without the overhead of additional assets.

Choose emoji-data for comprehensive emoji information and assets, or node-emoji for straightforward emoji operations in Node.js environments.

2,239

:love_letter: Find the emoji that echoes your mind.

Pros of emoji

  • Lightweight and focused solely on emoji functionality
  • Includes a command-line interface for easy emoji lookup
  • Supports custom emoji sets and allows adding new emojis

Cons of emoji

  • Less comprehensive emoji data compared to node-emoji
  • Fewer utility functions for working with emojis in strings
  • Not actively maintained (last update was in 2019)

Code Comparison

node-emoji:

const emoji = require('node-emoji');
console.log(emoji.get('coffee'));
console.log(emoji.emojify('I :heart: :coffee:!'));

emoji:

const emoji = require('emoji');
console.log(emoji.unicode('coffee'));
console.log(emoji.replace('I :heart: :coffee:!'));

Both libraries provide similar basic functionality for working with emojis, but node-emoji offers more extensive features and utilities. The emoji library focuses on core emoji operations and includes a CLI tool, which may be preferable for simpler use cases or command-line applications.

node-emoji has more frequent updates and a larger community, making it a more robust choice for long-term projects. However, emoji's lightweight nature and custom emoji support might be advantageous for specific use cases or when minimizing dependencies is a priority.

Choose node-emoji for comprehensive emoji handling in Node.js applications, or opt for emoji if you need a simpler solution with CLI capabilities and custom emoji support.

16,805

Emoji for everyone. https://twemoji.twitter.com/

Pros of Twemoji

  • Comprehensive emoji set with high-quality vector graphics
  • Cross-platform consistency and wide browser support
  • Actively maintained by Twitter with frequent updates

Cons of Twemoji

  • Larger file size due to SVG format
  • Requires additional setup for server-side rendering
  • May not integrate as seamlessly with Node.js projects

Code Comparison

node-emoji:

const emoji = require('node-emoji');
console.log(emoji.get('coffee'));  // ā˜•ļø
console.log(emoji.random().emoji); // šŸŽ²

Twemoji:

const twemoji = require('twemoji');
console.log(twemoji.parse('ā˜•ļø'));
// <img class="emoji" draggable="false" alt="ā˜•ļø" src="https://twemoji.maxcdn.com/v/latest/svg/2615.svg"/>

Key Differences

  • node-emoji focuses on simple text-based emoji insertion
  • Twemoji provides SVG-based emoji rendering for consistent appearance
  • node-emoji is more lightweight and easier to integrate in Node.js projects
  • Twemoji offers better visual quality and cross-platform consistency

Use Cases

  • Choose node-emoji for simple text-based emoji handling in Node.js applications
  • Opt for Twemoji when visual consistency and high-quality graphics are crucial, especially in web applications

Community and Maintenance

  • node-emoji has a smaller but active community
  • Twemoji benefits from Twitter's resources and regular updates

šŸŖ One component to pick them all

Pros of emoji-mart

  • Offers a complete emoji picker component for React, Preact, and Vue
  • Includes skin tone selection and search functionality
  • Provides customization options for appearance and behavior

Cons of emoji-mart

  • Larger package size due to more comprehensive features
  • May be overkill for simple emoji-related tasks
  • Requires more setup and configuration for basic use cases

Code Comparison

node-emoji:

const emoji = require('node-emoji');
console.log(emoji.get('coffee'));
console.log(emoji.random().emoji);

emoji-mart:

import { Picker } from 'emoji-mart';

<Picker set='apple' onSelect={this.addEmoji} />

Key Differences

node-emoji is a lightweight library focused on simple emoji operations like getting emoji by name or finding emoji in text. It's ideal for server-side or basic client-side emoji handling.

emoji-mart is a full-featured emoji picker component for front-end frameworks. It offers a rich user interface for emoji selection, including categories, search, and skin tone modifiers.

Use Case Recommendations

Choose node-emoji for:

  • Basic emoji operations in Node.js applications
  • Simple emoji insertion in text-based interfaces

Choose emoji-mart for:

  • Building feature-rich emoji pickers in web applications
  • Projects requiring advanced emoji selection and customization

Both libraries serve different purposes and can be chosen based on the specific requirements of your project.

2,363

Find relevant emoji from text on the command-line :open_mouth: :sparkles: :raised_hands: :horse: :boom: :see_no_evil:

Pros of emoj

  • Command-line interface for easy emoji search and insertion
  • Supports fuzzy search for finding emojis quickly
  • Integrates with clipboard for convenient copying

Cons of emoj

  • Limited to command-line usage, not suitable for programmatic integration
  • Fewer features for emoji manipulation compared to node-emoji

Code Comparison

node-emoji:

const emoji = require('node-emoji');
console.log(emoji.get('coffee'));
console.log(emoji.random());
console.log(emoji.search('smile'));

emoj:

$ emoj pizza
šŸ•

$ emoj "front facing baby chick"
šŸ„

Key Differences

node-emoji is a JavaScript library for working with emojis programmatically, offering functions for getting, searching, and manipulating emojis within Node.js applications. It provides a wide range of emoji-related operations and can be integrated into various projects.

emoj, on the other hand, is a command-line tool focused on searching and inserting emojis quickly. It's designed for interactive use in terminals and doesn't provide a programming API.

Use Cases

Choose node-emoji for:

  • Integrating emoji functionality into Node.js applications
  • Programmatically working with emojis (parsing, replacing, etc.)

Choose emoj for:

  • Quick emoji lookup and insertion in terminal environments
  • Command-line based workflows involving emojis

Both projects serve different purposes and can be valuable depending on the specific requirements of your project or workflow.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

node-emoji

Friendly emoji lookups and parsing utilities for Node.js. Ć°ĀŸĀ’Ā–

All Contributors: 32 Ć°ĀŸĀ‘ĀŖ Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict npm package version Contributor Covenant

node-emoji provides a fun, straightforward interface on top of the following excellent libraries:

  • emojilib: provides a list of emojis and keyword search on top of it
  • skin-tone: parses out base emojis from skin tones

Install

npm install node-emoji

2.0 Release Ć°ĀŸĀšĀ€

This is the new 2.0 release of node-emoji, supporting ESM, new emoji and a new API.

If you want to use the old version, please check out the legacy branch.

Usage

import * as emoji from 'node-emoji'

emoji.emojify('I :heart: :coffee:!') // 'I Ć¢ĀĀ¤ĆÆĀøĀ Ć¢Ā˜Ā•ĆÆĀøĀ!'

emoji.find('heart') // { emoji: 'Ć¢ĀĀ¤', name: 'heart' }
emoji.find('Ć¢ĀĀ¤ĆÆĀøĀ') // { emoji: 'Ć¢ĀĀ¤', name: 'heart' }

emoji.get('unicorn') // Ć°ĀŸĀ¦Ā„
emoji.get(':unicorn:') // Ć°ĀŸĀ¦Ā„

emoji.has(':pizza:') // true
emoji.has('Ć°ĀŸĀĀ•') // true
emoji.has('unknown') // false

emoji.random() // { name: 'house', emoji: 'Ć°ĀŸĀĀ ' }

emoji.replace('I Ć¢ĀĀ¤ĆÆĀøĀ coffee!', 'love', { preserveSpaces: true }) // 'I love coffee!'

emoji.search(':uni:') // [ { emoji: 'Ć°ĀŸĀ¦Ā„', name: 'unicorn' }, ... ]

emoji.strip('I Ć¢ĀĀ¤ĆÆĀøĀ coffee!') // 'I coffee!'

emoji.unemojify('Ć°ĀŸĀĀ• for Ć°ĀŸĀ’Āƒ') // ':pizza: for :dancer:'

emoji.which('Ć°ĀŸĀ¦Ā„') // 'unicorn'

API

emoji.emojify(input, options?)

Parse all markdown-encoded emojis in a string.

Parameters:

  1. input (string): The input string containing the markdown-encoding emojis.
  2. options (optional):
    • fallback (string; default: ""): The string to fallback to if an emoji was not found.
    • format (() => (emoji: string, part: string, string: string) => string; default: value => value): Add a middleware layer to modify each matched emoji after parsing.
import * as emoji from 'node-emoji'

console.log(emoji.emojify('The :unicorn: is a fictitious animal.'))
// 'The Ć°ĀŸĀ¦Ā„ is a fictitious animal.'

emoji.find(emoji)

Get the name and character of an emoji.

Parameters:

  1. emoji (string): The emoji to get the data of.
import * as emoji from 'node-emoji'

console.log(emoji.find('Ć°ĀŸĀ¦Ā„'))
// { name: 'unicorn', emoji: 'Ć°ĀŸĀ¦Ā„' }

emoji.get(name)

Get an emoji from an emoji name.

Parameters:

  1. name (string): The name of the emoji to get.
import * as emoji from 'node-emoji'

console.log(emoji.get('unicorn'))
// 'Ć°ĀŸĀ¦Ā„'

emoji.has(emoji)

Check if this library supports a specific emoji.

Parameters:

  1. emoji (string): The emoji to check.
import * as emoji from 'node-emoji'

console.log(emoji.has('Ć°ĀŸĀ¦Ā„'))
// true

emoji.random()

Get a random emoji.

import * as emoji from 'node-emoji'

console.log(emoji.random())
// { name: 'unicorn', emoji: 'Ć°ĀŸĀ¦Ā„' }

emoji.replace(input, replacement)

Replace the emojis in a string.

Parameters:

  • input (string): The input string.
  • replacement (string | (emoji: string, index: number, string: string) => string): The character to replace the emoji with. Can be either a string or a callback that returns a string.
import * as emoji from 'node-emoji'

console.log(emoji.replace('The Ć°ĀŸĀ¦Ā„ is a fictitious animal.', 'unicorn'))
// 'The unicorn is a fictitious animal.'

emoji.search(keyword)

Search for emojis containing the provided name in their name.

Parameters:

  1. keyword (string): The keyword to search for.
import * as emoji from 'node-emoji'

console.log(emoji.search('honey'))
// [ { name: 'honeybee', emoji: 'Ć°ĀŸĀĀ' }, { name: 'honey_pot', emoji: 'Ć°ĀŸĀĀÆ' } ]

emoji.strip(input, options?)

Remove all of the emojis from a string.

Parameters:

  1. input (string): The input string to strip the emojis from.

  2. options (optional):

    • preserveSpaces (boolean): Whether to keep the extra space after a stripped emoji.
import * as emoji from 'node-emoji'

console.log(emoji.strip('Ć°ĀŸĀ¦Ā„ The unicorn is a fictitious animal.'))
// 'The unicorn is a fictitious animal.'

console.log(
  emoji.strip('Ć°ĀŸĀ¦Ā„ The unicorn is a fictitious animal.', {
    preserveSpaces: true,
  }),
)
// ' The unicorn is a fictitious animal.'

emoji.unemojify(input)

Convert all emojis in a string to their markdown-encoded counterparts.

Parameters:

  1. input (string): The input string containing the emojis.
import * as emoji from 'node-emoji'

console.log(emoji.unemojify('The Ć°ĀŸĀ¦Ā„ is a fictitious animal.'))
// 'The :unicorn: is a fictitious animal.'

emoji.which(emoji, options?)

Get an emoji name from an emoji.

Parameters:

  1. emoji (string): The emoji to get the name of.
  2. options (optional):
    • markdown (boolean; default: false): Whether to return a ":emoji:" string instead of "emoji"
import * as emoji from 'node-emoji'

console.log(emoji.which('Ć°ĀŸĀ¦Ā„'))
// 'unicorn'

Development

See .github/Development.md.

License

FOSSA Status

Special Thanks

...to Anand Chowdhary (@AnandChowdhary) and his company Pabio for sponsoring this project via GitHub Sponsors!

Contributors

./cƂĀ²
./cƂĀ²

Ć°ĀŸĀ’Ā»
Adam Skoufis
Adam Skoufis

Ć°ĀŸĀ’Ā»
Adrian Carolli
Adrian Carolli

Ć°ĀŸĀ’Ā»
Alex Litel
Alex Litel

Ć°ĀŸĀ’Ā»
Alex Rudenko
Alex Rudenko

Ć°ĀŸĀ’Ā»
Antoine Hanriat
Antoine Hanriat

Ć°ĀŸĀ’Ā»
Daniel Bugl
Daniel Bugl

Ć°ĀŸĀĀ› Ć°ĀŸĀ’Ā» Ć°ĀŸĀ”Ā Ć°ĀŸĀ¤Ā” Ć°ĀŸĀšĀ‡ Ć°ĀŸĀ”Ā§ Ć°ĀŸĀšĀ§
Daniel Hilton
Daniel Hilton

Ć°ĀŸĀ’Ā»
Elizabeth
Elizabeth

Ć°ĀŸĀ’Ā» Ć°ĀŸĀšĀ§
Gabriel Csapo
Gabriel Csapo

Ć°ĀŸĀ’Ā»
Greenkeeper
Greenkeeper

Ć°ĀŸĀ’Ā»
Josh Goldberg Ć¢ĀœĀØ
Josh Goldberg Ć¢ĀœĀØ

Ć°ĀŸĀ”Ā§ Ć°ĀŸĀ’Ā» Ć°ĀŸĀšĀ‡ Ć°ĀŸĀšĀ§
Kevin Cooper
Kevin Cooper

Ć°ĀŸĀ’Ā»
Kristoffer K.
Kristoffer K.

Ć°ĀŸĀ’Ā»
Ludo Renzetti
Ludo Renzetti

Ć°ĀŸĀ’Ā»
Nicolas Charpentier
Nicolas Charpentier

Ć°ĀŸĀšĀ§
Nicolas Gryman
Nicolas Gryman

Ć°ĀŸĀ’Ā»
Paul Barber
Paul Barber

Ć°ĀŸĀ’Ā»
Richie Bendall
Richie Bendall

Ć°ĀŸĀ’Ā» Ć°ĀŸĀšĀ§
Ritik Banger
Ritik Banger

Ć°ĀŸĀ’Ā»
Roopak Venkatakrishnan
Roopak Venkatakrishnan

Ć°ĀŸĀ’Ā»
Shivkanth Bagavathy
Shivkanth Bagavathy

Ć°ĀŸĀ’Ā»
Siddharth Batra
Siddharth Batra

Ć°ĀŸĀ’Ā»
Stephan Meijer
Stephan Meijer

Ć°ĀŸĀ’Ā»
Thomas Beverley
Thomas Beverley

Ć°ĀŸĀĀ›
Tim Ruffles
Tim Ruffles

Ć°ĀŸĀ’Ā»
Todd Mazierski
Todd Mazierski

Ć°ĀŸĀĀ›
fossabot
fossabot

Ć°ĀŸĀ’Ā»
goodjun
goodjun

Ć°ĀŸĀĀ›
jackie luo
jackie luo

Ć°ĀŸĀ’Ā»
tgbtyty
tgbtyty

Ć°ĀŸĀ’Ā»
wtgtybhertgeghgtwtg
wtgtybhertgeghgtwtg

Ć°ĀŸĀ’Ā»

NPM DownloadsLast 30 Days