Encode Emojis
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/simbo/encode-emojis/ci.yml?branch=main)
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:
npm install --save encode-emojis
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);
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