encode-emojis
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Encode Emojis

npm Package Version License MIT GitHub Repo Native Typescript Support Coveralls Coverage GitHub Workflow Status

A javascript library that encodes emojis (only emojis!) to HTML entities.


Installation

This library is published to npm registry as encode-emojis.

You can install it:

# with npm
npm install --save encode-emojis

# with yarn
yarn add encode-emojis

ℹ️ HINT: This library is a pure ESM package. (You may want to read this.)

Usage

import { encodeEmojis } from 'encode-emojis';

let text = '<strong>Hello!</strong> 👋';

text = encodeEmojis(text);

console.log(text); // -> '<strong>Hello!</strong> &#x1f44b;'

Why?

Unfortunately, I am forced to use MS Teams for work, which - although it was working fine since forever - recently decided to fail on webhook event data that contains emojis.

But as my webhook event data contains not only emojis but also HTML, I needed to convert only emojis. So here we go…

License

MIT © Simon Lepel

Readme

Keywords

none

Package Sidebar

Install

npm i encode-emojis

Weekly Downloads

13

Version

1.0.2

License

MIT

Unpacked Size

5.19 kB

Total Files

6

Last publish

Collaborators

  • simbo