Skip to content

dsevillamartin/simple-emoji-map

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

simple-emoji-map

A simple emoji map package that builds its data whenever it's installed.

This package maps the emoji codes (2049) or unicode () and sets them equal to its shortnames (["interrobang","exclamation_question"]).

The data generated by this package comes from emojibase-data, released under the MIT License.

Usage

const emojis = require('simple-emoji-map');

Or using ES6 imports:

import emojis from 'simple-emoji-map';

Rebuilding

The JSON file is automatically generated on install.

To rebuild the JSON data file, it's a pretty simple process.

const build = require('simple-emoji-map/build');
// import build from 'simple-emoji-map/build';

build();

Config

To customize the build process, you will need either a .simple-emoji-map file or a simple-emoji-map property in package.json.

The shortcodes option selects which data set to use for the emoji codenames (see https://github.com/milesj/emojibase/tree/emojibase-data%407.0.1/packages/data/en/shortcodes).

The cldr and cldr-native values look to be supported in most languages (if not all), but the rest (emojibase, emojibase-legacy, github, etc) look to only exist for English.

{
  "lang": "en",
  "shortcodes": {
    "dataset": "emojibase",
    "lang": null,

    "fallbackDataset": null,
    "fallbackLang": null
  },

  "shortnames": {},
  "type": "emoji", // or 'codepoint',
  "regex": null // regex for whitelist
}

Shortnames

This is also the way to add custom shortnames to the map file.

For example, if you want car to show the emoji for red_car (1f697), the file or property would look something like this:

{
    "shortnames": {
        "1f697": ["car"]
    }
}

Keep in mind this will not replace any existing shortnames, only add to the emoji code's list.

About

A simple emoji map package that builds its data whenever it's installed.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published