Emojibase

17.0.0 · active · verified Sun Apr 19

Emojibase is a comprehensive JavaScript library providing lightweight, up-to-date, and localized emoji JSON datasets, alongside utility functions and regex patterns for working with emoji characters. It is currently stable at version 17.0.0, which aligns with Emoji v17 and CLDR 48, reflecting its regular cadence of updates with new Unicode and CLDR releases. Key differentiators include its direct construction from official Unicode emoji data sources, adherence to Unicode Technical Standard #51, and localization capabilities derived from UTS #35, ensuring high accuracy and broad language support. The library aims to provide a robust and specification-compliant solution for emoji handling in various applications.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates fetching all emoji data, finding a specific emoji, and using the emoji regular expression to match emojis within a string.

import { getEmojiData } from 'emojibase';
import { getEmojiRegex } from 'emojibase-regex';

async function processEmojis() {
  // Fetch all emoji data, defaulting to English
  const allEmojis = await getEmojiData('en');
  console.log(`Total emojis: ${allEmojis.length}`);

  // Find a specific emoji by hex code (e.g., grinning face)
  const grinningFace = allEmojis.find(emoji => emoji.hexcode === '1F600');
  if (grinningFace) {
    console.log(`Found emoji: ${grinningFace.emoji} - ${grinningFace.label}`);
  }

  // Get a regex that matches all known emojis
  const emojiRegex = getEmojiRegex();
  const text = "Hello world! 👋 This is an example with some emojis: 😂👍🌍.";
  const matchedEmojis = text.match(emojiRegex);

  if (matchedEmojis) {
    console.log(`
Emojis found in text: ${matchedEmojis.join(', ')}`);
  }

  // You can also filter based on properties like 'skins'
  const skinToneEmojis = allEmojis.filter(emoji => emoji.skins && emoji.skins.length > 0);
  console.log(`
Emojis with skin tones: ${skinToneEmojis.slice(0, 5).map(e => e.emoji).join(', ')}...`);
}

processEmojis().catch(console.error);

view raw JSON →