UNPKG

@thi.ng/emoji

Version:

Bi-directional lookup tables mapping emoji names & their characters

127 lines (88 loc) 3.38 kB
<!-- This file is generated - DO NOT EDIT! --> <!-- Please see: https://codeberg.org/thi.ng/umbrella/src/branch/develop/CONTRIBUTING.md#changes-to-readme-files --> # ![@thi.ng/emoji](https://codeberg.org/thi.ng/umbrella/media/branch/develop/assets/banners/thing-emoji.svg?2371a385) [![npm version](https://img.shields.io/npm/v/@thi.ng/emoji.svg)](https://www.npmjs.com/package/@thi.ng/emoji) ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/emoji.svg) [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi) > [!NOTE] > This is one of 215 standalone projects. LLM-free, human-made and > cared for software, maintained as part of the > [@thi.ng/umbrella](https://codeberg.org/thi.ng/umbrella/) ecosystem and > anti-framework. > > 🚀 Please help me to work full-time on these projects by [sponsoring > me](https://codeberg.org/thi.ng/umbrella/src/branch/develop/CONTRIBUTING.md#donations). > Thank you! ❤️ - [About](#about) - [References](#references) - [Status](#status) - [Installation](#installation) - [Dependencies](#dependencies) - [API](#api) - [Authors](#authors) - [License](#license) ## About Bi-directional lookup tables mapping emoji names & their characters. There're lots of other emoji packages available, most of them with various additional functionality & dependencies. In contrast, this package merely provides simple bi-directional mappings between emoji names & their actual characters. The function [`replaceNames()`]() can be used to replace all _known_ `:emoji_name:` occurrences in a given string with their corresponding emoji character... ### References The [index](https://codeberg.org/thi.ng/umbrella/src/branch/develop/packages/emoji/src/emoji.ts) is based on the one used by [node-emoji](https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json) (which itself is sourced from the [js-emoji](https://github.com/iamcal/js-emoji) package). For reasons of uniformity, all hyphens (`-`) in names have been replaced with underscores (`_`). ## Status **ALPHA** - bleeding edge / work-in-progress [Search or submit any issues for this package](https://codeberg.org/thi.ng/umbrella/issues?q=%5Bemoji%5D) ## Installation ```bash yarn add @thi.ng/emoji ``` ESM import: ```ts import * as emoji from "@thi.ng/emoji"; ``` Browser ESM import: ```html <script type="module" src="https://esm.run/@thi.ng/emoji"></script> ``` [JSDelivr documentation](https://www.jsdelivr.com/) For Node.js REPL: ```js const emoji = await import("@thi.ng/emoji"); ``` Package sizes (brotli'd, pre-treeshake): ESM: 11.84 KB ## Dependencies None ## API [Generated API docs](https://docs.thi.ng/umbrella/emoji/) ```ts tangle:export/readme.ts import { EMOJI, NAMES, replaceNames } from "@thi.ng/emoji"; console.log(EMOJI["minibus"]); // "🚐" console.log(NAMES["🚐"]); // "minibus" console.log(replaceNames("Amazing :grin::heart_eyes::invalid:!")); // "Amazing 😁😍:invalid:!" ``` ## Authors - [Karsten Schmidt](https://thi.ng) If this project contributes to an academic publication, please cite it as: ```bibtex @misc{thing-emoji, title = "@thi.ng/emoji", author = "Karsten Schmidt", note = "https://thi.ng/emoji", year = 2023 } ``` ## License &copy; 2023 - 2026 Karsten Schmidt // Apache License 2.0