github-emoji
GitHub emoji library for deno.
Usage
Get a emoji string of a name (e.g. smile
), use emojiOf
function like:
import { emojiOf } from "./mod.ts";
console.log(emojiOf("smile"));
// -> βΊοΈ
The emojiOf
require EmojiName
instead of string
so invalid emoji name
become TypeScript error.
import { EmojiName, emojiOf } from "./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 "./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.