# unicode-emoji-utils

> A collection of utilities for emojis

Latest version **1.3.1** (published 2025-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install unicode-emoji-utils
pnpm add unicode-emoji-utils
yarn add unicode-emoji-utils
bun add unicode-emoji-utils
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2025-04-22 |
| First published | 2022-10-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Minh Cung |
| Maintainers | cungminh2710 |
| Keywords | unicode, emoji, smiley, utilities, regex |

## Links

- npm: https://www.npmjs.com/package/unicode-emoji-utils
- Repository: https://github.com/cungminh2710/unicode-emoji-utils
- Homepage: https://github.com/cungminh2710/unicode-emoji-utils#readme
- Issues: https://github.com/cungminh2710/unicode-emoji-utils/issues
- npm.io page: https://npm.io/package/unicode-emoji-utils

## Dependencies (1)

- [emoji-regex-xs](https://npm.io/package/emoji-regex-xs.md) ^2.0.0

## Recent versions

- 1.3.1 (latest) — 2025-04-22
- 1.3.0 — 2025-04-22
- 1.2.0 — 2023-10-17
- 1.1.2 — 2023-03-14
- 1.1.1 — 2022-11-15
- 1.1.0 — 2022-11-11
- 1.0.1 — 2022-11-10
- 1.0.0 — 2022-10-26

## README

# 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 16.0` from [Unicode](https://home.unicode.org/emoji/about-emoji/).

## 🔌 Installation

Using `npm`

```shell
npm install unicode-emoji-utils
```

Or `yarn`

```shell
yarn add unicode-emoji-utils
```

## Usage

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

### Check valid EmojiVersion (type guard)
```javascript
isValidEmojiVersion("1.0"); // true
isValidEmojiVersion("1.2"); // false
isValidEmojiVersion(1); // false
```

### Check whether a text has emojis

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

### Strip emojis from a given text

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

### Extract Emojis

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

### Get All Emojis

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

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

### Filter Emoijs by the Unicode Version

```javascript
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

```javascript
getAllComponents();
```

```javascript
{
  "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

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

---
_Source: https://npm.io/package/unicode-emoji-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
