npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

easy-emoji

v1.1.5

Published

Exactly as this project's name, easy-emoji provide some `solutions` which displaying a emoji on old system or browser, and it is easy to integrate it to your project. ❤️

Readme

Overview 📖

Exactly as this project's name, easy-emoji provide some solutions which displaying a emoji on old system or browser, and it is easy to integrate it to your project. ❤️

😄 If you have curiosities for the compatible problems that some older system or browser cannot display certain emoji, you could read the blog named All about emoji by me.

Usage 🔧

Firstly, ensure that you already installed it on your project, otherwise use the command in your project. 💪

npm i easy-emoji -S

I classify these solutions into three modes which named Image mode, SVG mode, and Font mode, Easy emoji just use the Image mode to help you to do this, And It will support all solutions in the near future. 🏆

Modules

| Name | Type | Default | Description | | :---------------------------: | :-------------------------: | :-----------------------------------------------------------: | :---------------------------------------------------------------------------------- | | emojiData | {Array} | [{ id, name, alias },...] | 877 objects which including the id, name and alias for a emoji in an array. | | getEmojiData | {Function} | getEmojiData([1,2,3]) | Get certain emojis by slice or an array you provided | | findPositionByName | {Function} | findPositionByName("smile") | Find the position of the Sprite by a emoji's name | | getIdByName | {Function} | getIdByName("smile") | Get the emoji's id by its name | | getHTMLTextNodes | {Function} | getHTMLTextNodes("Hi[smile]") | Get the interpreted nodes that help you to recognize which is emojiCode or normal text node | | getCodeByName | {Function} | getCodeByName("smile") | Get the emojiCode which help you to display in a input element | | matchEmojiIndexFromCode | {Function} | matchEmojiIndexFromCode("Where is the [laughing] emoji?") | Querying whether there is an emojiCode in a string that conforms to the rule | |

emojiData

import easyEmoji from "easy-emoji";
const { emojiData } = easyEmoji;
function renderEmojiList() {
	return <ul className={"easy-emoji-list"}>
                {
               	    emojiData.map(({ name, alies, id }) => {
               	    	return  <li
                           key={id}
                           className={"emoji"}
                           data-emoji-name={name}
                           id={`e_${id}`}
                        > </li>
               	    })
               	}
    </ul>
}

😄For above example, apparently we only need the emojiData to map its styles to the element, yeah, it's enough for some simple situations, actually it load a sprites which including 877 emojis and the size is about 2.4MB.

getEmojiData

😺So,if you do not need such much of emojis, you can provide a list indicating what emojis you want to use, This is a example for the situation.

import { getEmojiData }  from "easy-emoji";
const emojiList = getEmojiData(3/*start index*/, 5/*end index*/); // or getEmojiData([3,4]);
// ... Ignoring the process that rendering the emojiList data, the behavior as same as above example.

findPositionByName

Get the position of the Sprite by name.

import {findPositionByName} from "easy-emoji";
findPositionByName("smile");
// [-69, 0]
// [x, y]

So, we can set the background-position to your element, we don't really need this method, we could just use the class emoji and Id e_{emojiId} to an element if these styles has no side-effects for your page.

getHTMLTextNodes

const htmlNodes = getHTMLTextNodes("Wow, [smie][[crescent_moon]I like[smirk][smirk] easy emoji");
// [
//     {text: "Wow, ", cssId: null},
//     {text: null, cssId: "e_2"},
//     {text: "[", cssId: null},
//     {text: null, cssId: "e_301"},
//     {text: "I like", cssId: null},
//     {text: null, cssId: "e_8"},
//     {text: null, cssId: "e_8"},
//     {text: " easy emoji", cssId: null}
// ]

So, below is a example that how to process these Nodes when we received a message.

import { getHTMLTextNodes } from "easy-emoji";

const TextMessage = props => {
  const messageText = props.data.text;
  const htmlNodes = getHTMLTextNodes(messageText);
  return (
    <div className="sc-message--text">
      {htmlNodes.map(({ text, cssId }) => {
        return text ? <span> { text } </span> : (
          <div className={"emoji"} id={cssId} />
        );
      })}
    </div>
  );
};

getCodeByName

import { getCodeByName } from "easy-emoji";
function renderInput() {
	const [inputValue, setInputValue] = useState("");
	const handleChange = () => {
		setInputValue(inputValue)
	}
	const onPickupEmoji = emoji => {
		// the emoji is one of the getEmojiData.
		setInputValue(inputValue + getCodeByName(emoji.name))
	}
	return <div>
	    <input type="text" onChange={handleChange} />
	    <PickupEmojiModal onPickUp={} />
    </div>
}

matchEmojiIndexFromCode

return a list which including all the emojiCode,

import { matchEmojiIndexFromCode } from "easy-emoji";
console.log(matchEmojiIndexFromCode("555[smile]fff[crescent_moon]"));
// ["smile", "crescent_moon"]

getIdByName

Get the emoji's id which represent the id of an object of the emojiData, and you could also to get it manually by the emojiData.