github-emoji
GitHub emoji library for TypeScript.
Usage
Get a emoji string of a name (e.g. smile
), use emojiOf
function like:
import { emojiOf } from "https://deno.land/x/github_emoji@$MODULE_VERSION/mod.ts";
console.log(emojiOf("smile"));
// -> βΊοΈ
The emojiOf
require EmojiName
instead of string
so invalid emoji name
become TypeScript error.
import {
EmojiName,
emojiOf,
} from "https://deno.land/x/github_emoji@$MODULE_VERSION/mod.ts";
console.log(emojiOf("smile")); // OK
//console.log(emojiOf("this-is-not-valid-emoji-name")); // TypeScript error
console.log(emojiOf("this-is-not-valid-emoji-name" as EmojiName)); // OK but returns undefined
Replace all valid :{name}:
like strings (e.g. π
) in a text with emoji
strings, use emojify
function like:
import { emojify } from "https://deno.land/x/github_emoji@$MODULE_VERSION/mod.ts";
console.log(emojify("Hello :world: π")); // :world: is not valid emoji
// -> Hello :world: βΊοΈ
See API documentation for more details and functions.
License
The code follows MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.
Special Thanks
This library is strongly inspired by rhysd/node-github-emoji.