Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

node-emoji

> 编程语言
Open source

simple emoji support for node.js projects

1.3K stars0 likes0 views
WebsiteGitHub

About

simple emoji support for node.js projects

node-emoji

Friendly emoji lookups and parsing utilities for Node.js.

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

…

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

Special Thanks

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

Contributors

./c²

Adam Skoufis

Adrian Carolli

Alex Litel

Alex Rudenko

Antoine Hanriat

Daniel Bugl

Daniel Hilton

Elizabeth

Gabriel Csapo

Greenkeeper

Josh Goldberg ✨

Kevin Cooper

Kristoffer K.

Ludo Renzetti

Nicolas Charpentier

Nicolas Gryman

Paul Barber

Richie Bendall

Ritik Banger

Roopak Venkatakrishnan

Shivkanth Bagavathy

Siddharth Batra

Stephan Meijer

Thomas Beverley

Tim Ruffles

Todd Mazierski

fossabot

goodjun

jackie luo

tgbtyty

wtgtybhertgeghgtwtg

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •emojilib: provides a list of emojis and keyword search on top of it
  • •skin-tone: parses out base emojis from skin tones
  • •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.
  • •input (string): The input string.
  • •replacement (string | (emoji: string, index: number, string: string) => string): The character to replace the emoji with.
  • •preserveSpaces (boolean): Whether to keep the extra space after a stripped emoji.
  • •markdown (boolean; default: false): Whether to return a ":emoji:" string instead of "emoji"

> Tags

TypeScriptemojiemoji-supportjavascriptnode

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言