Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/julien-marcou/unicode-emoji

Raw data for Unicode Emoji 🙂
https://github.com/julien-marcou/unicode-emoji

csv dataset emoji emoticon json smiley unicode

Last synced: about 2 months ago
JSON representation

Raw data for Unicode Emoji 🙂

Awesome Lists containing this project

README

        

# Unicode Emoji

[![NPM Package](https://img.shields.io/npm/v/unicode-emoji?label=release&color=%23cd2620&logo=npm)](https://www.npmjs.com/package/unicode-emoji)
[![Unicode Emoji v15.1](https://img.shields.io/badge/emoji-v15.1-yellow?logo=unicode&logoColor=yellow)](https://unicode.org/Public/emoji/15.1/)
[![GitHub Repository](https://img.shields.io/github/stars/Julien-Marcou/Unicode-Emoji?color=%23f5f5f5&logo=github)](https://github.com/Julien-Marcou/Unicode-Emoji)

![Downloads per Month](https://img.shields.io/npm/dm/unicode-emoji)
![Repository Size](https://img.shields.io/github/repo-size/Julien-Marcou/Unicode-Emoji?color=%23063a8d)
![Gzip Size](https://img.shields.io/bundlephobia/minzip/unicode-emoji?label=gzip%20size)
![No Dependency](https://img.shields.io/badge/dependencies-none-%23872a84)
![MIT License](https://img.shields.io/npm/l/unicode-emoji)

Raw data for Unicode Emoji 🙂

The data are generated using the `Unicode Emoji, Version 15.1` from [Unicode](https://home.unicode.org/emoji/about-emoji/).

You can learn more about emojis at [Emojipedia](https://emojipedia.org/) or find some implementation details and trivia on the [Wiki](https://github.com/Julien-Marcou/Unicode-Emoji/wiki).

## 👉 Demo

Check the generated [CSV file](https://github.com/Julien-Marcou/Unicode-Emoji/blob/master/unicode-emoji.csv).

Or just [take a look](https://emoji.julien-marcou.fr/) at what you can achieve using this package.

## 🔌 Installation

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

## 🧰 Usage

This NPM package uses the ECMAScript Modules system, so the easiest way to use it, is with a Bundler (like WebPack), so you don't have to worry about how to make it available and import it.

### With a Bundler

You can simply import it wherever you need it :

```javascript
import * as unicodeEmoji from 'unicode-emoji';
```

### With Node.js

ES Modules are only supported since Node.js v14.

#### Targeting CommonJS

When targeting CommonJS, you don't have access to static import, so you'll have to use dynamic import :

```javascript
const unicodeEmoji = await import('unicode-emoji');
```

Also, you'll need to import it inside an async function, as top-level await is not supported for CommonJS.

#### Targeting ES Module

When setting `"type": "module"` inside your `package.json` or when importing it from a `.mjs` file, you can simply use the ES6 import syntax :

```javascript
import * as unicodeEmoji from 'unicode-emoji';
```

### From a web browser

If you are not using a bundler, you'll have to expose the `unicode-emoji/index.js` file so it is accessible from the web.

#### Using the full path

```html

import * as unicodeEmoji from '/node_modules/unicode-emoji/index.js';

```
#### Using Import Maps

[Import Maps](https://wicg.github.io/import-maps/) can be very useful when you have several dependencies between different modules, as it allows you to import modules using their names instead of their full path.

But they are not implemented in any browser yet, so you'll have to use a polyfill :

```html

{
"imports": {
"unicode-emoji": "/node_modules/unicode-emoji/index.js"
}
}

import * as unicodeEmoji from 'unicode-emoji';

```

## 📚 Documentation

### Retrieve emojis

```javascript
unicodeEmoji.getEmojis();
```

```javascript
[
{
"emoji": "😀", // Emoji without skin tone variation
"description": "grinning face",
"version": "1.0",
"keywords": ["face", "grin", "grinning face"],
"category": "face-emotion",
"group": "smileys-emotion",
"subgroup": "face-smiling"
},
{
"emoji": "👋", // Emoji with skin tone variations
"description": "waving hand",
"version": "0.6",
"keywords": ["hand", "wave", "waving"],
"category": "face-emotion",
"group": "people-body",
"subgroup": "hand-fingers-open",
"variations": [
{
"emoji": "👋🏻",
"description": "waving hand: light skin tone",
"version": "1.0"
},
{
"emoji": "👋🏼",
"description": "waving hand: medium-light skin tone",
"version": "1.0"
},
// ...
]
},
// ...
]
```

### Retrieve components

```javascript
unicodeEmoji.getComponents();
```

```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"
},
// ...
]
}
```

### Grouping & filtering

You can group & filter emojis by category, group, subgroup or version

Here is an example :
- grouped by category
- without emojis from the flags category
- without emojis from the 0.6 & 0.7 versions
- without emojis from all versions above version 12.0 (does not exclude emojis from the version 12.0)

```javascript
const groupBy = 'category';
const omitWhere = { versionAbove: '12.0', category: ['flags'], version: ['0.6', '0.7'] };

// Only omitting
unicodeEmoji.getEmojis(omitWhere);

// Only grouping
unicodeEmoji.getEmojisGroupedBy(groupBy);

// Grouping and omitting
unicodeEmoji.getEmojisGroupedBy(groupBy, omitWhere);
```

Keep in mind that :

```javascript
const omitWhere = { versionAbove: '13.0' };
```

Is equivalent to :

```javascript
const omitWhere = { version: ['13.1', '14.0', '15.0', '15.1'] };
```

But you should always use the first one, as it will be future-proof for when new versions of `unicode-emoji` are released.

So that updating your dependencies will not opt you into newer emojis that are not yet supported on every platforms.

## 📋 Details

While complete data are available on GitHub :
- `unicode-emoji.csv` provides complete flat data
- `unicode-emoji.json` provides complete hierarchical data

Only the stripped-down `unicode-emoji.js` file is bundled within the NPM package to greatly reduce its size