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.

20 lines 631 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = isEmoji; /** * 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 */ 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