1.1.3 • Published 2 years ago

emoji-random-list v1.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

emoji-random-list package

Simple yet powerful npm package for querying emoji. Note: the project could be unstable since it's stil wip.

Example

npm i emoji-random-list
var emoji = require("emoji-random-list")
console.log(emoji.random({n: 5, group: 'objects'}))
//[ '🪒', '📕', '🔋', '🔩', '💷' ]

Usage

Functions:

FunctionDescription
listGet list of emoji
randomGet random lists of emoji

Parameters:

Valid for both list and random functions.

Parameter: typeDescriptionDefault value
n: intNumber of emoji to retrieve1 for random function, 0 (means all) for list function
allstatus: boolBy default only emoji with status "fully-qualified" are retrieved.false
noduplicates: boolIn the retrieved list no duplicates are allowed by default. This means that the n value must be considered as a massimum value.true
group: stringGroups of emoji allowed*"" (all groups are allowed)
subgroup: stringSubgroups of emoji allowed*"" (all subgroups are allowed)
nogroup: stringGroups of emoji not allowed*"" (all groups are allowed)
nosubgroup: stringSubgroups of emoji not allowed*"" (all subgroups are allowed)
skintones: boolSkintones where present.false for list function, true for listrandom function
v: boolIf the request is verbose, a dictionary is retrieved.false
search: stringFilter by search terms."" (no filter is applied)
maxversion: numberMax version of the emoji14.0
genders: boolIf true, all genders of people are allowed, neutral gender only otherwisefalse
offset: numberOffset between the first emoji and the start of the return list. (avaible only for the list function)0

*concatenate more terms with ,. See below for the list of groups and subgroups

Data Source

The data is parsed from https://unicode.org/Public/emoji/15.0/emoji-test.txt into a JSON list of dictionaries from which the emoji are retrieved. The list, created with the helper/dumper.py script, is updated with the very version of Unicode emoji. Each dictionary presents several information reguarding an emoji, and can be retrieved using the verbose v=true parameter. An example is reported. The file emoji.json can be also used for new API.

 {
        "emoji": "🌵",
        "description": "cactus",
        "group": "Animals & Nature",
        "subgroup": "plant-other",
        "code": "1F335",
        "status": "fully-qualified",
        "version": "E0.6"
    }

Emoji Groups and Subgroups

Usable in the query parameters. Multi word terms must be formatted in kebab-case, "&" must be replaced with "and".

{
    "Smileys & Emotion": ["face-smiling", "face-affection", "face-tongue", "face-hand", "face-neutral-skeptical", "face-sleepy", "face-unwell", "face-hat", "face-glasses", "face-concerned", "face-negative", "face-costume", "cat-face", "monkey-face", "emotion"], 
    "People & Body": ["hand-fingers-open", "hand-fingers-partial", "hand-single-finger", "hand-fingers-closed", "hands", "hand-prop", "body-parts", "person", "person-gesture", "person-role", "person-fantasy", "person-activity", "person-sport", "person-resting", "family", "person-symbol"], 
    "Component": ["skin-tone", "hair-style"], 
    "Animals & Nature": ["animal-mammal", "animal-bird", "animal-amphibian", "animal-reptile", "animal-marine", "animal-bug", "plant-flower", "plant-other"], 
    "Food & Drink": ["food-fruit", "food-vegetable", "food-prepared", "food-asian", "food-marine", "food-sweet", "drink", "dishware"], 
    "Travel & Places": ["place-map", "place-geographic", "place-building", "place-religious", "place-other", "transport-ground", "transport-water", "transport-air", "hotel", "time", "sky & weather"], 
    "Activities": ["event", "award-medal", "sport", "game", "arts & crafts"],
    "Objects": ["clothing", "sound", "music", "musical-instrument", "phone", "computer", "light & video", "book-paper", "money", "mail", "writing", "office", "lock", "tool", "science", "medical", "household", "other-object"], 
    "Symbols": ["transport-sign", "warning", "arrow", "religion", "zodiac", "av-symbol", "gender", "math", "punctuation", "currency", "other-symbol", "keycap", "alphanum", "geometric"],
    "Flags": ["flag", "country-flag", "subdivision-flag"]
    }

Licence and contributing

The code is released under MIT Licence. Feel free to open issues and PRs and suggest new ideas. Please star 🌟 the repo if you find it useful!