node-emoji

  • Version 2.2.0
  • Published
  • 64.5 kB
  • 4 dependencies
  • MIT license

Install

npm i node-emoji
yarn add node-emoji
pnpm add node-emoji

Overview

Friendly emoji lookups and parsing utilities for Node.js. 💖

Index

Functions

function emojify

emojify: (input: string, { fallback, format }?: EmojifyOptions) => string;
  • Parse all markdown-encoded emojis in a string.

function find

find: (codeOrName: string) => { emoji: string; key: string } | undefined;
  • Get the name and character of an emoji.

function get

get: (codeOrName: string) => string | undefined;
  • Get an emoji from an emoji name.

function has

has: (codeOrName: string) => boolean;
  • Check if this library supports a specific emoji.

function random

random: () => { emoji: string; name: string };
  • Get a random emoji.

function replace

replace: (
input: string,
replacement: ReplaceReplacement | string,
{ preserveSpaces }?: { preserveSpaces?: boolean | undefined }
) => string;
  • Replace the emojis in a string.

search: (keyword: RegExp | string) => { emoji: string; name: string }[];
  • Search for emojis containing the provided name or pattern in their name.

function strip

strip: (input: string, { preserveSpaces }?: StripOptions) => string;
  • Remove all the emojis from a string.

function unemojify

unemojify: (input: string) => string;
  • Convert all emojis in a string to their markdown-encoded counterparts.

function which

which: (emoji: string, { markdown }?: WhichOptions) => string | undefined;
  • Get an emoji name from an emoji.

Interfaces

interface EmojifyOptions

interface EmojifyOptions {}

    property fallback

    fallback?: ((part: string) => string) | string;
    • The string to fallback to if an emoji was not found.

    property format

    format?: EmojifyFormat;
    • Adds a middleware layer to modify each matched emoji after parsing.

    interface StripOptions

    interface StripOptions {}

      property preserveSpaces

      preserveSpaces?: boolean;
      • Whether to keep the extra space after a stripped emoji.

      interface WhichOptions

      interface WhichOptions {}

        property markdown

        markdown?: boolean;

          Type Aliases

          type EmojifyFormat

          type EmojifyFormat = (name: string, part?: string, input?: string) => string;

            type ReplaceReplacement

            type ReplaceReplacement = (emoji: Emoji, index: number, string: string) => string;

              Package Files (1)

              Dependencies (4)

              Dev Dependencies (38)

              Peer Dependencies (0)

              No peer dependencies.

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/node-emoji.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/node-emoji)
              • HTML
                <a href="https://www.jsdocs.io/package/node-emoji"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>