UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

17 lines 542 B
/** * Checks whether a given string contains an emoji. * * @param str - The string to check for emojis. * @returns A boolean indicating whether the string contains an emoji. * * @example * isEmoji("😊"); // Output: true * isEmoji("hello"); // Output: false * isEmoji("👋 hello!"); // Output: true */ export default function isEmoji(str) { // Emoji regex pattern (matches most emojis) const emojiRegex = /[\p{Emoji}\u200d\u20e3\u25aa\u2b06\ufe0f]/gu; return emojiRegex.test(str); } //# sourceMappingURL=isEmoji.js.map