Giter Club home page Giter Club logo

emojipedia's Introduction

The Emojipedia Technical Information Library

Unofficial static export of emoji technical information from Emojipedia. πŸ“™

πŸ‘ͺ All Contributors: 2 🀝 Code of Conduct: Kept πŸ§ͺ Coverage πŸ“ License: MIT πŸ“¦ npm version πŸ’ͺ TypeScript: Strict

Usage

npm i emojipedia

Data

The emojipedia package exports an emojipedia/data export of roughly all emojis on emojipedia. Data for each emoji can beΒ imported by its PascalCase name:

import { SparklingHeart } from "emojipedia/data";

console.log(SparklingHeart);
/*
{
	"code": "πŸ’–",
	"slug": "sparkling-heart",
	"title": "Sparkling Heart",
	// ...
}
*/

Alternately, you can import emoji data from the individual .json files by their kebab-case slug name using JSON import assertions:

import sparklingHeart from "emojipedia/data/sparkling-heart.json" assert { type: "json" };

console.log(sparklingHeart);
/*
{
	"code": "πŸ’–",
	"slug": "sparkling-heart",
	"title": "Sparkling Heart",
	// ...
}
*/

Node.js APIs

The functions used to generate Emojipedia data are exported as well. In order from low-level to high-level:

  1. getEmoji
  2. getEmojis
  3. rebuildDirectory

getEmoji

Retrieves data for an emoji by its slug. This sends a single network request to the Emojipedia GraphQL API.

import { getEmoji } from "emojipedia";

const emoji = await getEmoji("sparkling-heart");
console.log(emoji);
/*
{
	"code": "πŸ’–",
	"slug": "sparkling-heart",
	"title": "Sparkling Heart",
	// ...
}
*/

See the TypeScript types for a complete description of emoji properties.

getEmojis

Retrieves data for an array of emoji slugs by calling getEmoji for each slug.

import { getEmojis } from "emojipedia";

const emojis = await getEmojis(["heart-on-fire", "sparkling-heart"]);
console.log(emojis);
/*
[
	{
		"code": "❀️‍πŸ”₯",
		"slug": "heart-on-fire",
		"title": "Heart on Fire",
		// ...
	},
	{
		"code": "πŸ’–",
		"slug": "sparkling-heart",
		"title": "Sparkling Heart",
		// ...
	}
]
*/

Note that network requests are p-throttle throttled to a maximum of 10 calls at each 100ms interval.

rebuildDirectory

Clears and recreates a directory to contain an index.mjs, an index.d.ts, and a *.json file for each emoji slug.

import { rebuildDirectory } from "emojipedia";

await rebuildDirectory({
	directory: "lib/data",
});

rebuildDirectory will call getEmojis with each of the emoji slugs as defined by unicode-emoji-json.

Contributors

Josh Goldberg ✨
Josh Goldberg ✨

πŸ’» πŸ–‹ πŸ“– πŸ€” πŸš‡ 🚧 πŸ“† πŸ”§ πŸ›
Megan Middleton
Megan Middleton

⚠️

πŸ’™ This package was templated with create-typescript-app.

emojipedia's People

Contributors

joshuakgoldberg avatar allcontributors[bot] avatar renovate[bot] avatar

Stargazers

Xinjie Shen avatar  avatar JoΓ£o Palmeiro avatar Ducky Coding avatar Alexandr Zahatski avatar uncenter avatar Matvey avatar Emmanuel Salomon avatar Nikitas Frantzeskakis avatar Luiz Fernando da Silva Cieslak avatar Khoa avatar  avatar  avatar Gianluigi avatar

Watchers

 avatar  avatar

emojipedia's Issues

πŸš€ Feature: Create initial version

Bug Report Checklist

Overview

Filing an issue for tracking! I want the initial version of this package to expose two areas of things:

  • JSON/POJO data for each emoji, as retrieved by the Emojipedia API
  • Node.js APIs that can be used to retrieve that data

I.e.:

import { SparklingHeart } from "emojipedia/data";

console.log(SparklingHeart);
/*
{
	"code": "πŸ’–",
	"slug": "sparkling-heart",
	"title": "Sparkling Heart",
	// ...
}
*/

...and:

import { getEmoji } from "emojipedia";

const emoji = await getEmoji("sparkling-heart");
console.log(emoji);
/*
{
	"code": "πŸ’–",
	"slug": "sparkling-heart",
	"title": "Sparkling Heart",
	// ...
}
*/

Additional Info

No response

πŸ› Bug: Missing slugs that have a discrepency between Emojipedia and Unicode

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Expected

All unicode emojis should be available in this package.

Actual

There are about 60 emojis that don't yet have a matched slug in emojipedia:

Could not find slug: a-button
Could not find slug: ab-button
Could not find slug: b-button
Could not find slug: blue-circle
Could not find slug: blue-square
Could not find slug: brown-circle
Could not find slug: brown-square
Could not find slug: bullseye
Could not find slug: eight-o-clock
Could not find slug: eleven-o-clock
Could not find slug: enraged-face
Could not find slug: face-with-crossed-out-eyes
Could not find slug: five-o-clock
Could not find slug: flag-cocos-islands
Could not find slug: flag-cote-d-ivoire
Could not find slug: flag-myanmar
Could not find slug: flag-u-s-outlying-islands
Could not find slug: flag-u-s-virgin-islands
Could not find slug: four-o-clock
Could not find slug: ginger-root
Could not find slug: green-circle
Could not find slug: green-square
Could not find slug: keycap-0
Could not find slug: keycap-1
Could not find slug: keycap-2
Could not find slug: keycap-3
Could not find slug: keycap-4
Could not find slug: keycap-5
Could not find slug: keycap-6
Could not find slug: keycap-7
Could not find slug: keycap-8
Could not find slug: keycap-9
Could not find slug: man-s-shoe
Could not find slug: men-s-room
Could not find slug: nine-o-clock
Could not find slug: o-button
Could not find slug: one-o-clock
Could not find slug: orange-circle
Could not find slug: orange-square
Could not find slug: purple-circle
Could not find slug: purple-square
Could not find slug: red-circle
Could not find slug: red-exclamation-mark
Could not find slug: red-question-mark
Could not find slug: red-square
Could not find slug: rescue-worker-s-helmet
Could not find slug: seven-o-clock
Could not find slug: six-o-clock
Could not find slug: smiling-face-with-open-hands
Could not find slug: ten-o-clock
Could not find slug: three-o-clock
Could not find slug: twelve-o-clock
Could not find slug: two-o-clock
Could not find slug: water-pistol
Could not find slug: woman-s-boot
Could not find slug: woman-s-clothes
Could not find slug: woman-s-hat
Could not find slug: woman-s-sandal
Could not find slug: women-s-room
Could not find slug: yellow-circle
Could not find slug: yellow-square

Additional Info

The way this emojipedia package is sourcing its slugs is from its unicode-emoji-json dependency. It looks like there's a mismatch between the Emojipedia site and unicode-emoji-json. I'll need to dig into this.

For example, Emojipedia stores 🟑 as https://emojipedia.org/large-yellow-circle, but unicode-emoji-json stores it as yellow-circle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.