UNPKG

emoji-api

Version:
140 lines (138 loc) 4.92 kB
interface EmojiData { emoji: string; name: string; group: EmojiGroup; sub_group: EmojiSubGroup; codepoints: string; } declare const emojis: EmojiData[]; declare type EmojiGroup = "Smileys & Emotion" | "People & Body" | "Animals & Nature" | "Food & Drink" | "Travel & Places" | "Activities" | "Objects" | "Symbols" | "Flags"; declare type EmojiSubGroup = "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" | "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" | "animal-mammal" | "animal-bird" | "animal-amphibian" | "animal-reptile" | "animal-marine" | "animal-bug" | "plant-flower" | "plant-other" | "food-fruit" | "food-vegetable" | "food-prepared" | "food-asian" | "food-marine" | "food-sweet" | "drink" | "dishware" | "place-map" | "place-geographic" | "place-building" | "place-religious" | "place-other" | "transport-ground" | "transport-water" | "transport-air" | "hotel" | "time" | "sky & weather" | "event" | "award-medal" | "sport" | "game" | "arts & crafts" | "clothing" | "sound" | "music" | "musical-instrument" | "phone" | "computer" | "light & video" | "book-paper" | "money" | "mail" | "writing" | "office" | "lock" | "tool" | "science" | "medical" | "household" | "other-object" | "transport-sign" | "warning" | "arrow" | "religion" | "zodiac" | "av-symbol" | "gender" | "math" | "punctuation" | "currency" | "other-symbol" | "keycap" | "alphanum" | "geometric" | "flag" | "country-flag" | "subdivision-flag"; declare class Emoji { private readonly _data; /** * Represents an emoji * @param _data The emoji data */ constructor(_data: EmojiData); /** * The Emoji */ get emoji(): string; /** * The emoji name */ get name(): string; /** * The emoji name */ get formattedName(): string; /** * The emoji group */ get group(): EmojiGroup; /** * The emoji subgroup */ get subGroup(): EmojiSubGroup; /** * The emoji code points */ get codePoints(): string[]; /** * Twemoji url of this emoji */ twemoji(opt?: { size?: string; format?: "png" | "svg"; }): string; /** * Returns fancy name of this emoji */ get fancyName(): string; /** * Unicode of this emoji */ toUnicode(): string; /** * String representation of this emoji */ toString(): string; /** * Array representation of this emoji */ toArray(): { fancyName: string; twemoji: string; unicode: string; formattedName: string; emoji: string; name: string; group: EmojiGroup; sub_group: EmojiSubGroup; codepoints: string; }[]; /** * Static method to create emoji instance * @param emoji The emoji data */ static from(emoji: EmojiData): Emoji; /** * JSON representation of this emoji */ toJSON(): { fancyName: string; twemoji: string; unicode: string; formattedName: string; emoji: string; name: string; group: EmojiGroup; sub_group: EmojiSubGroup; codepoints: string; }; } /** * Returns all emoji */ declare function all(): Emoji[]; /** * Returns arranged emojis */ declare function arrange(): Record<EmojiGroup, Emoji[]>; /** * Get specific emoji * @param emoji The emoji to find */ declare function get(emoji: string): Emoji | null; /** * Filter emoji by its data * @param fn Filter fn */ declare function filter(fn: (emoji: Emoji) => boolean): Emoji[]; /** * Get random emoji */ declare function random(): Emoji; /** * Get random emoji from a specific group * @param group The group name * @param subGroup The subgroup name */ declare function randomFromGroup(group: EmojiGroup, subGroup?: EmojiSubGroup): Emoji; /** * Find emoji by name * @param name The emoji name */ declare function findByName(name: string): Emoji | null; /** * Convert emoji to unicode * @param emoji The emoji */ declare function emojiToUnicode(emoji: string): string; /** * Convert unicode to emoji * @param unicode The unicode */ declare function unicodeToEmoji(unicode: string): string; export { Emoji, EmojiGroup, EmojiSubGroup, all, arrange, emojiToUnicode, emojis, filter, findByName, get, random, randomFromGroup, unicodeToEmoji };