UNPKG

artytext

Version:

A comprehensive utility library for text manipulation, slug generation, password generation, case conversion, and more. Works with both TypeScript and JavaScript.

959 lines (952 loc) 30.1 kB
const UPPERCASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; const LOWERCASE_CHARS = 'abcdefghijklmnopqrstuvwxyz'; const NUMBERS = '0123456789'; const SYMBOLS = '!@#$%^&*()_+-=[]{}|;:,.<>?'; const SIMILAR_CHARS = 'il1Lo0O'; const AMBIGUOUS_CHARS = '{}[]()/\\\'"`~,;:.<>'; /** * Generate a random password with specified options * @param options - Password generation options * @returns Generated password string */ function generatePassword(options = {}) { const { length = 12, includeUppercase = true, includeLowercase = true, includeNumbers = true, includeSymbols = false, excludeSimilar = false, excludeAmbiguous = false, } = options; let charset = ''; if (includeUppercase) charset += UPPERCASE_CHARS; if (includeLowercase) charset += LOWERCASE_CHARS; if (includeNumbers) charset += NUMBERS; if (includeSymbols) charset += SYMBOLS; if (excludeSimilar) { charset = charset.split('').filter(char => !SIMILAR_CHARS.includes(char)).join(''); } if (excludeAmbiguous) { charset = charset.split('').filter(char => !AMBIGUOUS_CHARS.includes(char)).join(''); } if (charset.length === 0) { throw new Error('No character set available with the given options'); } let password = ''; // Ensure at least one character from each selected character set (after exclusions) const requiredChars = []; if (includeUppercase) { const upperChars = excludeSimilar ? UPPERCASE_CHARS.split('').filter(char => !SIMILAR_CHARS.includes(char)).join('') : UPPERCASE_CHARS; const upperCharsFiltered = excludeAmbiguous ? upperChars.split('').filter(char => !AMBIGUOUS_CHARS.includes(char)).join('') : upperChars; if (upperCharsFiltered) requiredChars.push(upperCharsFiltered[Math.floor(Math.random() * upperCharsFiltered.length)]); } if (includeLowercase) { const lowerChars = excludeSimilar ? LOWERCASE_CHARS.split('').filter(char => !SIMILAR_CHARS.includes(char)).join('') : LOWERCASE_CHARS; const lowerCharsFiltered = excludeAmbiguous ? lowerChars.split('').filter(char => !AMBIGUOUS_CHARS.includes(char)).join('') : lowerChars; if (lowerCharsFiltered) requiredChars.push(lowerCharsFiltered[Math.floor(Math.random() * lowerCharsFiltered.length)]); } if (includeNumbers) { const numChars = excludeSimilar ? NUMBERS.split('').filter(char => !SIMILAR_CHARS.includes(char)).join('') : NUMBERS; const numCharsFiltered = excludeAmbiguous ? numChars.split('').filter(char => !AMBIGUOUS_CHARS.includes(char)).join('') : numChars; if (numCharsFiltered) requiredChars.push(numCharsFiltered[Math.floor(Math.random() * numCharsFiltered.length)]); } if (includeSymbols) { const symChars = excludeSimilar ? SYMBOLS.split('').filter(char => !SIMILAR_CHARS.includes(char)).join('') : SYMBOLS; const symCharsFiltered = excludeAmbiguous ? symChars.split('').filter(char => !AMBIGUOUS_CHARS.includes(char)).join('') : symChars; if (symCharsFiltered) requiredChars.push(symCharsFiltered[Math.floor(Math.random() * symCharsFiltered.length)]); } // Add required characters first for (let i = 0; i < Math.min(requiredChars.length, length); i++) { password += requiredChars[i]; } // Fill the rest with random characters for (let i = password.length; i < length; i++) { const randomIndex = Math.floor(Math.random() * charset.length); password += charset[randomIndex]; } // Shuffle the password return password.split('').sort(() => Math.random() - 0.5).join(''); } /** * Generate a memorable password using words * @param wordCount - Number of words to use (default: 4) * @param separator - Separator between words (default: '-') * @param includeNumbers - Whether to include numbers (default: true) * @returns Memorable password string */ function generateMemorablePassword(wordCount = 4, separator = '-', includeNumbers = true) { const words = [ 'apple', 'banana', 'cherry', 'dragon', 'eagle', 'forest', 'garden', 'house', 'island', 'jungle', 'knight', 'lemon', 'mountain', 'ocean', 'planet', 'queen', 'river', 'star', 'tiger', 'umbrella', 'village', 'water', 'xylophone', 'yellow', 'zebra', 'adventure', 'beautiful', 'creative', 'delicious', 'excellent' ]; const selectedWords = []; for (let i = 0; i < wordCount; i++) { const randomIndex = Math.floor(Math.random() * words.length); selectedWords.push(words[randomIndex]); } let password = selectedWords.join(separator); if (includeNumbers) { const randomNumber = Math.floor(Math.random() * 1000); password += randomNumber.toString(); } return password; } /** * Check password strength and return a score * @param password - Password to check * @returns Object with score (0-100) and feedback */ function checkPasswordStrength(password) { const feedback = []; let score = 0; // Length check if (password.length < 8) { feedback.push('Password should be at least 8 characters long'); } else if (password.length >= 12) { score += 25; } else { score += 15; } // Character variety checks if (/[a-z]/.test(password)) score += 10; else feedback.push('Include lowercase letters'); if (/[A-Z]/.test(password)) score += 10; else feedback.push('Include uppercase letters'); if (/[0-9]/.test(password)) score += 10; else feedback.push('Include numbers'); if (/[^A-Za-z0-9]/.test(password)) score += 15; else feedback.push('Include special characters'); // Complexity checks if (/(.)\1{2,}/.test(password)) { score -= 10; feedback.push('Avoid repeated characters'); } if (/^(.)\1+$/.test(password)) { score -= 20; feedback.push('Avoid using the same character repeatedly'); } // Common patterns (only exact matches or common sequences) if (/123|abc|qwe|admin/i.test(password) || /^password$/i.test(password)) { score -= 15; feedback.push('Avoid common patterns'); } // Determine strength level let strength; if (score < 30) strength = 'weak'; else if (score < 50) strength = 'fair'; else if (score < 65) strength = 'good'; else if (score < 85) strength = 'strong'; else strength = 'very-strong'; return { score: Math.max(0, Math.min(100, score)), feedback, strength }; } /** * Generate a URL-friendly slug from a string * @param text - Text to convert to slug * @param options - Slug generation options * @returns URL-friendly slug string */ function generateSlug(text, options = {}) { const { separator = '-', lowercase = true, removeSpecialChars = true, maxLength, } = options; if (!text) return ''; let slug = text; // Convert to lowercase if specified if (lowercase) { slug = slug.toLowerCase(); } // Remove special characters and replace with separator if (removeSpecialChars) { // Replace spaces and special characters with separator slug = slug .replace(/[^\w\s-]/g, '') // Remove special characters except spaces and hyphens .replace(/[\s_-]+/g, separator) // Replace spaces, underscores, and multiple hyphens with separator .replace(new RegExp(`^${separator}|${separator}$`, 'g'), ''); // Remove leading/trailing separators } else { // Only replace spaces with separator slug = slug .replace(/\s+/g, separator) .replace(new RegExp(`^${separator}|${separator}$`, 'g'), ''); } // Apply max length if specified if (maxLength && slug.length > maxLength) { slug = slug.substring(0, maxLength); // Remove trailing separator if it exists if (slug.endsWith(separator)) { slug = slug.slice(0, -separator.length); } } return slug; } /** * Generate a slug with timestamp for unique URLs * @param text - Text to convert to slug * @param options - Slug generation options * @returns Unique slug with timestamp */ function generateUniqueSlug(text, options = {}) { const baseSlug = generateSlug(text, options); const timestamp = Date.now().toString(36); return `${baseSlug}-${timestamp}`; } /** * Generate a slug with random suffix for unique URLs * @param text - Text to convert to slug * @param options - Slug generation options * @param suffixLength - Length of random suffix (default: 6) * @returns Unique slug with random suffix */ function generateRandomSlug(text, options = {}, suffixLength = 6) { const baseSlug = generateSlug(text, options); const randomSuffix = Math.random().toString(36).substring(2, 2 + suffixLength); return `${baseSlug}-${randomSuffix}`; } /** * Convert a slug back to readable text * @param slug - Slug to convert back * @param separator - Separator used in the slug (default: '-') * @returns Readable text */ function slugToText(slug, separator = '-') { if (!slug) return ''; return slug .replace(new RegExp(separator, 'g'), ' ') .replace(/\b\w/g, l => l.toUpperCase()); } /** * Check if a string is a valid slug * @param slug - String to check * @param separator - Expected separator (default: '-') * @returns True if valid slug */ function isValidSlug(slug, separator = '-') { if (!slug) return false; // Escape special regex characters in separator const escapedSeparator = separator.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); const slugRegex = new RegExp(`^[a-z0-9${escapedSeparator}]+$`); return slugRegex.test(slug) && !slug.startsWith(separator) && !slug.endsWith(separator); } /** * Generate a random integer between min and max (inclusive) * @param min - Minimum value (default: 0) * @param max - Maximum value (default: 100) * @returns Random integer */ function randomInt(min = 0, max = 100) { // Handle single parameter case (treat as max) if (arguments.length === 1) { max = min; min = 0; } return Math.floor(Math.random() * (max - min + 1)) + min; } /** * Generate a random float between min and max * @param min - Minimum value (default: 0) * @param max - Maximum value (default: 1) * @param decimals - Number of decimal places (default: 2) * @returns Random float */ function randomFloat(min = 0, max = 1, decimals = 2) { const random = Math.random() * (max - min) + min; return Number(random.toFixed(decimals)); } /** * Generate a random string with specified options * @param options - Random string generation options * @returns Random string */ function randomString(options = {}) { const { length = 10, charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', } = options; let result = ''; for (let i = 0; i < length; i++) { result += charset.charAt(Math.floor(Math.random() * charset.length)); } return result; } /** * Generate a random number string * @param length - Length of the number string (default: 6) * @returns Random number string */ function randomNumberString(length = 6) { return randomString({ length, charset: '0123456789' }); } /** * Generate a random hexadecimal string * @param length - Length of the hex string (default: 8) * @param uppercase - Whether to use uppercase letters (default: false) * @returns Random hex string */ function randomHex(length = 8, uppercase = false) { const hex = randomString({ length, charset: '0123456789abcdef' }); return uppercase ? hex.toUpperCase() : hex; } /** * Generate a random UUID (version 4) * @returns Random UUID string */ function randomUUID() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } /** * Generate a random color in hex format * @param includeHash - Whether to include # prefix (default: true) * @returns Random hex color */ function randomColor(includeHash = true) { const color = Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0'); return includeHash ? `#${color}` : color; } /** * Generate a random RGB color * @returns Random RGB color object */ function randomRGB() { return { r: randomInt(0, 255), g: randomInt(0, 255), b: randomInt(0, 255), }; } /** * Generate a random item from an array * @param array - Array to pick from * @returns Random item from array */ function randomItem(array) { if (array.length === 0) { throw new Error('Cannot pick random item from empty array'); } return array[Math.floor(Math.random() * array.length)]; } /** * Generate multiple random items from an array * @param array - Array to pick from * @param count - Number of items to pick * @param allowDuplicates - Whether to allow duplicate picks (default: false) * @returns Array of random items */ function randomItems(array, count, allowDuplicates = false) { if (array.length === 0) { throw new Error('Cannot pick random items from empty array'); } if (count > array.length && !allowDuplicates) { throw new Error(`Cannot pick ${count} unique items from array of length ${array.length}`); } if (allowDuplicates) { const result = []; for (let i = 0; i < count; i++) { result.push(randomItem(array)); } return result; } else { const shuffled = [...array].sort(() => Math.random() - 0.5); return shuffled.slice(0, count); } } /** * Generate a random boolean * @param probability - Probability of true (0-1, default: 0.5) * @returns Random boolean */ function randomBoolean(probability = 0.5) { return Math.random() < probability; } /** * Generate a random date within a range * @param startDate - Start date (default: 1 year ago) * @param endDate - End date (default: now) * @returns Random date */ function randomDate(startDate, endDate) { const start = startDate || new Date(Date.now() - 365 * 24 * 60 * 60 * 1000); const end = endDate || new Date(); return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); } /** * Convert text to different case formats * @param text - Text to convert * @param options - Case conversion options * @returns Converted text */ function changeCase(text, options) { const { type, preserveWords = false } = options; if (!text) return ''; switch (type) { case 'lowercase': return text.toLowerCase(); case 'uppercase': return text.toUpperCase(); case 'camelCase': return toCamelCase(text, preserveWords); case 'kebab-case': return toKebabCase(text, preserveWords); case 'snake_case': return toSnakeCase(text, preserveWords); case 'pascalCase': return toPascalCase(text, preserveWords); case 'titleCase': return toTitleCase(text, preserveWords); case 'sentenceCase': return toSentenceCase(text, preserveWords); default: return text; } } /** * Convert to camelCase * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns camelCase text */ function toCamelCase(text, preserveWords = false) { if (!text) return ''; const words = splitIntoWords(text, preserveWords); return words .map((word, index) => { if (index === 0) { return word.toLowerCase(); } return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); }) .join(''); } /** * Convert to kebab-case * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns kebab-case text */ function toKebabCase(text, preserveWords = false) { if (!text) return ''; const words = splitIntoWords(text, preserveWords); return words.map(word => word.toLowerCase()).join('-'); } /** * Convert to snake_case * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns snake_case text */ function toSnakeCase(text, preserveWords = false) { if (!text) return ''; const words = splitIntoWords(text, preserveWords); return words.map(word => word.toLowerCase()).join('_'); } /** * Convert to PascalCase * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns PascalCase text */ function toPascalCase(text, preserveWords = false) { if (!text) return ''; const words = splitIntoWords(text, preserveWords); return words .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(''); } /** * Convert to Title Case * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns Title Case text */ function toTitleCase(text, preserveWords = false) { if (!text) return ''; const words = splitIntoWords(text, preserveWords); return words .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(' '); } /** * Convert to Sentence case * @param text - Text to convert * @param preserveWords - Whether to preserve word boundaries * @returns Sentence case text */ function toSentenceCase(text, preserveWords = false) { if (!text) return ''; const sentences = text.split(/[.!?]+/).filter(sentence => sentence.trim()); return sentences .map(sentence => { const trimmed = sentence.trim(); if (!trimmed) return ''; const words = splitIntoWords(trimmed, preserveWords); const firstWord = words[0]; const restWords = words.slice(1); return (firstWord.charAt(0).toUpperCase() + firstWord.slice(1).toLowerCase() + restWords.map(word => word.toLowerCase()).join(' ')); }) .join('. ') + (text.endsWith('.') ? '.' : ''); } /** * Split text into words based on various delimiters * @param text - Text to split * @param preserveWords - Whether to preserve existing word boundaries * @returns Array of words */ function splitIntoWords(text, preserveWords = false) { if (preserveWords) { // Split by spaces, hyphens, underscores, and camelCase boundaries return text .split(/[\s\-_]+|(?=[A-Z][a-z])/) .filter(word => word.length > 0); } else { // Split by any non-alphanumeric character return text .split(/[^a-zA-Z0-9]+/) .filter(word => word.length > 0); } } /** * Convert text to alternating case (aLtErNaTiNg) * @param text - Text to convert * @returns Alternating case text */ function toAlternatingCase(text) { if (!text) return ''; return text .split('') .map((char, index) => { if (index % 2 === 0) { return char.toLowerCase(); } else { return char.toUpperCase(); } }) .join(''); } /** * Convert text to sponge case (mOcKiNg) * @param text - Text to convert * @returns Sponge case text */ function toSpongeCase(text) { if (!text) return ''; return text .split('') .map(char => { if (Math.random() > 0.5) { return char.toUpperCase(); } else { return char.toLowerCase(); } }) .join(''); } /** * Convert text to dot.case * @param text - Text to convert * @returns dot.case text */ function toDotCase(text) { if (!text) return ''; const words = splitIntoWords(text); return words.map(word => word.toLowerCase()).join('.'); } /** * Convert text to CONSTANT_CASE * @param text - Text to convert * @returns CONSTANT_CASE text */ function toConstantCase(text) { if (!text) return ''; const words = splitIntoWords(text); return words.map(word => word.toUpperCase()).join('_'); } /** * Truncate text to a specified length * @param text - Text to truncate * @param options - Truncation options * @returns Truncated text */ function truncate(text, options) { const { length, suffix = '...', preserveWords = false, separator = ' ', } = options; if (!text || text.length <= length) { return text; } if (preserveWords) { const words = text.split(separator); let result = ''; for (const word of words) { if ((result + word + suffix).length <= length) { result += (result ? separator : '') + word; } else { break; } } return result + suffix; } else { return text.substring(0, length - suffix.length) + suffix; } } /** * Reverse a string * @param text - Text to reverse * @returns Reversed text */ function reverse(text) { if (!text) return ''; return text.split('').reverse().join(''); } /** * Count words in text * @param text - Text to count words in * @returns Number of words */ function countWords(text) { if (!text) return 0; return text.trim().split(/\s+/).filter(word => word.length > 0).length; } /** * Count characters in text (with or without spaces) * @param text - Text to count characters in * @param includeSpaces - Whether to include spaces in count (default: true) * @returns Number of characters */ function countCharacters(text, includeSpaces = true) { if (!text) return 0; return includeSpaces ? text.length : text.replace(/\s/g, '').length; } /** * Remove duplicate characters from text * @param text - Text to remove duplicates from * @param caseSensitive - Whether to consider case (default: false) * @returns Text with duplicate characters removed */ function removeDuplicates(text, caseSensitive = false) { if (!text) return ''; const seen = new Set(); const result = []; for (const char of text) { const key = caseSensitive ? char : char.toLowerCase(); if (!seen.has(key)) { seen.add(key); result.push(char); } } return result.join(''); } /** * Remove duplicate words from text * @param text - Text to remove duplicate words from * @param caseSensitive - Whether to consider case (default: false) * @returns Text with duplicate words removed */ function removeDuplicateWords(text, caseSensitive = false) { if (!text) return ''; const words = text.split(/\s+/); const seen = new Set(); const result = []; for (const word of words) { const key = caseSensitive ? word : word.toLowerCase(); if (!seen.has(key)) { seen.add(key); result.push(word); } } return result.join(' '); } /** * Mask text according to a pattern * @param text - Text to mask * @param options - Masking options * @returns Masked text */ function mask(text, options) { const { pattern, placeholder = '*', reverse = false } = options; if (!text || !pattern) return text; let result = ''; let textIndex = reverse ? text.length - 1 : 0; for (let i = 0; i < pattern.length; i++) { const patternChar = pattern[i]; if (patternChar === '#') { if (reverse) { if (textIndex >= 0) { result = text[textIndex] + result; textIndex--; } else { result = placeholder + result; } } else { if (textIndex < text.length) { result += text[textIndex]; textIndex++; } else { result += placeholder; } } } else { result += patternChar; } } return result; } /** * Format text according to common patterns * @param text - Text to format * @param options - Formatting options * @returns Formatted text */ function format(text, options) { const { type, format: formatString, locale = 'en-US' } = options; if (!text) return ''; switch (type) { case 'phone': return formatPhone(text, formatString); case 'credit-card': return formatCreditCard(text, formatString); case 'ssn': return formatSSN(text); case 'zip': return formatZip(text); case 'currency': return formatCurrency(text, locale); default: return text; } } /** * Format phone number * @param phone - Phone number to format * @param format - Format pattern (default: '(###) ###-####') * @returns Formatted phone number */ function formatPhone(phone, format = '(###) ###-####') { const digits = phone.replace(/\D/g, ''); return mask(digits, { pattern: format }); } /** * Format credit card number * @param card - Credit card number to format * @param format - Format pattern (default: '#### #### #### ####') * @returns Formatted credit card number */ function formatCreditCard(card, format = '#### #### #### ####') { const digits = card.replace(/\D/g, ''); return mask(digits, { pattern: format }); } /** * Format SSN * @param ssn - SSN to format * @returns Formatted SSN */ function formatSSN(ssn) { const digits = ssn.replace(/\D/g, ''); return mask(digits, { pattern: '###-##-####' }); } /** * Format ZIP code * @param zip - ZIP code to format * @returns Formatted ZIP code */ function formatZip(zip) { const digits = zip.replace(/\D/g, ''); if (digits.length === 9) { return mask(digits, { pattern: '#####-####' }); } return mask(digits, { pattern: '#####' }); } /** * Format currency * @param amount - Amount to format * @param locale - Locale for formatting * @returns Formatted currency */ function formatCurrency(amount, locale) { const num = parseFloat(amount); if (isNaN(num)) return amount; return new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', }).format(num); } /** * Capitalize first letter of each word * @param text - Text to capitalize * @returns Capitalized text */ function capitalize(text) { if (!text) return ''; return text .split(' ') .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(' '); } /** * Capitalize first letter of first word only * @param text - Text to capitalize * @returns Text with first letter capitalized */ function capitalizeFirst(text) { if (!text) return ''; return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); } /** * Remove extra whitespace from text * @param text - Text to clean * @returns Cleaned text */ function removeExtraWhitespace(text) { if (!text) return ''; return text.replace(/\s+/g, ' ').trim(); } /** * Remove all whitespace from text * @param text - Text to clean * @returns Text without whitespace */ function removeWhitespace(text) { if (!text) return ''; return text.replace(/\s/g, ''); } /** * Escape HTML special characters * @param text - Text to escape * @returns Escaped text */ function escapeHtml(text) { if (!text) return ''; const htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;', }; return text.replace(/[&<>"']/g, char => htmlEscapes[char]); } /** * Unescape HTML special characters * @param text - Text to unescape * @returns Unescaped text */ function unescapeHtml(text) { if (!text) return ''; const htmlUnescapes = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'", }; return text.replace(/&amp;|&lt;|&gt;|&quot;|&#39;/g, entity => htmlUnescapes[entity]); } // Export all types // Default export with all utilities const artytext = { // Password utilities generatePassword, generateMemorablePassword, checkPasswordStrength, // Slug utilities generateSlug, generateUniqueSlug, generateRandomSlug, slugToText, isValidSlug, // Random utilities randomInt, randomFloat, randomString, randomNumberString, randomHex, randomUUID, randomColor, randomRGB, randomItem, randomItems, randomBoolean, randomDate, // Case utilities changeCase, toCamelCase, toKebabCase, toSnakeCase, toPascalCase, toTitleCase, toSentenceCase, toAlternatingCase, toSpongeCase, toDotCase, toConstantCase, // Text utilities truncate, reverse, countWords, countCharacters, removeDuplicates, removeDuplicateWords, mask, format, capitalize, capitalizeFirst, removeExtraWhitespace, removeWhitespace, escapeHtml, unescapeHtml, }; export { capitalize, capitalizeFirst, changeCase, checkPasswordStrength, countCharacters, countWords, artytext as default, escapeHtml, format, generateMemorablePassword, generatePassword, generateRandomSlug, generateSlug, generateUniqueSlug, isValidSlug, mask, randomBoolean, randomColor, randomDate, randomFloat, randomHex, randomInt, randomItem, randomItems, randomNumberString, randomRGB, randomString, randomUUID, removeDuplicateWords, removeDuplicates, removeExtraWhitespace, removeWhitespace, reverse, slugToText, toAlternatingCase, toCamelCase, toConstantCase, toDotCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toSpongeCase, toTitleCase, truncate, unescapeHtml }; //# sourceMappingURL=index.esm.js.map