@lobehub/fluent-emoji
Version:
Fluent Emoji are a collection of familiar, friendly, and modern emoji from Microsoft
20 lines (19 loc) • 626 B
JavaScript
import emojilib from "@lobehub/emojilib/index.json" with { type: "json" };
import emojiRegex from "emoji-regex";
//#region src/getEmojiByCharacter/index.ts
/**
* `@lobehub/emojilib` exposes a bare `index.json` as its entry, which Node's ESM
* loader rejects without an explicit type attribute.
*/
const getEmoji = (emoji) => {
const regex = emojiRegex();
return emoji.match(regex)?.[0];
};
const getEmojiNameByCharacter = (emoji) => {
const pureEmoji = getEmoji(emoji);
if (!pureEmoji) return;
return emojilib?.[pureEmoji];
};
//#endregion
export { getEmoji, getEmojiNameByCharacter };
//# sourceMappingURL=index.mjs.map