Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twemoji-parser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twemoji-parser

Parser for identifying Twemoji in text

  • 12.1.2
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is twemoji-parser?

The twemoji-parser npm package is a utility for parsing and processing emoji characters in text using the Twemoji library. It allows you to identify, extract, and manipulate emoji characters in strings, making it useful for applications that need to handle emoji-rich content.

What are twemoji-parser's main functionalities?

Parsing Emojis

This feature allows you to parse a string and identify all the emoji characters within it. The `parse` method returns an array of objects, each representing an emoji found in the text.

const twemojiParser = require('twemoji-parser');
const text = 'Hello 🌍!';
const parsed = twemojiParser.parse(text);
console.log(parsed);

Converting Emojis to HTML

This feature allows you to convert parsed emoji characters into their corresponding HTML code points. This can be useful for rendering emojis in web applications.

const twemojiParser = require('twemoji-parser');
const text = 'Hello 🌍!';
const parsed = twemojiParser.parse(text);
const html = parsed.map(emoji => twemojiParser.toCodePoint(emoji.text)).join('');
console.log(html);

Extracting Emoji URLs

This feature allows you to extract URLs for the emoji images from the parsed text. The URLs point to the Twemoji CDN, where the emoji images are hosted.

const twemojiParser = require('twemoji-parser');
const text = 'Hello 🌍!';
const parsed = twemojiParser.parse(text);
const urls = parsed.map(emoji => `https://twemoji.maxcdn.com/v/latest/72x72/${twemojiParser.toCodePoint(emoji.text)}.png`);
console.log(urls);

Other packages similar to twemoji-parser

FAQs

Package last updated on 24 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc