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 🙏

© 2024 – Pkg Stats / Ryan Hefner

emojison

v1.0.1

Published

npm package letting you access any base64 emoji image from https://unicode.org/emoji/charts/full-emoji-list.html

Downloads

15

Readme

emojison

npm package letting you access any base64 emoji image from https://unicode.org/emoji/charts/full-emoji-list.html.

The goal of this package is to provide an easy access to ALL existing emoji images, while being able to choose the emoji style with its service, Twitter, Apple, Google, ...

The downside to the easy access is that all images are stored into json files that can get pretty heavy (a few MB), which is why it is encouraged to load only the service you will use in your app, thus loading less data in RAM.

Usage

npm install --save emojison
const Emojison = require('emojison');

const e = new Emojison('appl');

e.currentService(); // check chosen service, appl in this case

e.getData(); // get the json file data

e.getEmoji('grinning face'); // get an object with base64 src, index, codes
                            // and utf-8 version on the emoji

e.getEmojiSrc('face with tongue'); // directly return the base64 source
                                  // empty string if there is no src for the chosen service

e.getEmojiSrc('grinning face', 'appl'); // return the apple style grinning face emoji source

API

Constructor

Take the service name as parameter, defaults to goog and can take all or emoji to load all services images at once.

new Emojison(); // load goog.json file

new Emojison('kddi'); // load kddi.json file

new Emojison('all'); // load emoji.json file, with all services images
new Emojison('emoji'); // same as above

currentService()

Returns the currently loaded service

const e = new Emojison();
e.currentService(); // returns 'goog'

getData()

Returns the loaded json file object. Data layout can be found here.

const e = new Emojison();
e.getData(); // returns a big object

getEmoji(emojiName)

Returns the emoji object associated to the name, undefined if no entry is found

const e = new Emojison();
e.getEmoji('grinning face'); // { src: 'data:image/png...', codes: [...], ... }
e.getEmoji('my new emoji'); // undefined

getEmojiSrc(emojiName, serviceName)

Returns the image src of the selected service. If all or emoji was chosen as an initial service, the second parameter will let you chose between the emoji different images. An empty string will be returned if the service does not support the emoji.

const e = new Emojison('appl');
e.getEmojiSrc('my new emoji') // undefined
e.getEmojiSrc('grinning face') // 'data:image/png;base64...' apple style
e.getEmojiSrc('grinning face', 'goog') // second parameter is ignored

const j = new Emojison('all');
j.getEmojiSrc('grinning face') // { goog: 'base64image', appl: 'base64image', ... }
j.getEmojiSrc('grinning face', 'goog') // 'data:image/png;base64...' google style
j.getEmojiSrc('grinning face', 'kddi') // ''

For more info about supported services and emoji name list, please check https://unicode.org/emoji/charts/full-emoji-list.html, https://unicode.org/emoji/format.html#col-vendor, or https://github.com/Valkyrihane/emoji-scrapper.

Note that all emoji and service names are lowercase versions of those seen in the previous links.

Troubleshooting

For data troubleshooting, please file an issue on the scrapping repo. Otherwise, feel free to create an issue on this repo, I will answer it as soon as I can.

Json files come from here.

Alternatives

https://raw.githubusercontent.com/omnidan/node-emoji/master/lib/emoji.json

https://github.com/mrowa44/emojify

https://github.com/node-modules/emoji

https://github.com/omnidan/node-emoji