Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unicode-emoji-utils

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unicode-emoji-utils

A collection of utilities for emojis

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

unicode-emoji-utils

A collection of utilities for emojis and raw data for Unicode Emojis

  • Support CommonJS and ES Module

  • Full list of Unicode Emoji, Version 15.1 from Unicode.

🔌 Installation

Using npm

npm install unicode-emoji-utils

Or yarn

yarn add unicode-emoji-utils

Usage

import { type Emoji, getAllEmojis, hasEmoji, compareVersion, stripEmojies, filterEmojis, getAllComponents, extractEmojis, getEmojisByGroup } from 'unicode-emoji-utils';

Check valid EmojiVersion (type guard)

isValidEmojiVersion("1.0"); // true
isValidEmojiVersion("1.2"); // false
isValidEmojiVersion(1); // false

Check whether a text has emojis

hasEmoji('a'); // false
hasEmoji('a 🫶'); // true

Strip emojis from a given text

stripEmoji('a 🫶'); // 'a '

Extract Emojis

extractEmoji('👋🏼adfsadfs safdsaf dsafds 🫶'); // ['👋🏼', '🫶']

Get All Emojis

getAllEmojis(); // ['🫶', '👋🏼', '🙏🏿', '👨🏻‍🤝‍👨🏼', '👬', ...]

const emojis = [{emoji: '🫶', version: '14.0' }];
getAllEmojis(emojis); // ['🫶']

Filter Emoijs by the Unicode Version

filterEmojis('14.0'); // Filter Emojis from version 14.0 and below

filterEmojis('14.0', true); // Only returns emoji with version 14.0

const emojis = [{emoji: '🫶', version: '14.0' }];
filterEmojis('14.0', true, emojis); // [{emoji: '🫶', version: '14.0' }]
filterEmojis('14.0', false, emojis); // [{emoji: '🫶', version: '14.0' }]
filterEmojis('1.0', false, emojis); // []

Retrieve Unicode components

getAllComponents();
{
  "skin-tone": [
    {
      "emoji": "🏻",
      "description": "light skin tone",
      "version": "1.0"
    },
    {
      "emoji": "🏼",
      "description": "medium-light skin tone",
      "version": "1.0"
    },
    // ...
  ],
  "hair-style": [
    {
      "emoji": "🦰",
      "description": "red hair",
      "version": "11.0"
    },
    {
      "emoji": "🦱",
      "description": "curly hair",
      "version": "11.0"
    },
    // ...
  ]
}

Get Emojis by group, subgroup or category

getEmojisByGroup('group');
getEmojisByGroup('subgroup');
getEmojisByGroup('category');

Keywords

FAQs

Package last updated on 17 Oct 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc