export function toPluralString(word: string, count: number): string { if (count == 1) { return word } const ending = ['s', 'sh', 'ch', 'x', 'z'].some((chars) => word.endsWith(chars), ) ? 'es' : 's' return `${word}${ending}` } export function kebabCase(string: string): string { return string .replace(/([a-z])([A-Z])/g, '$1-$2') .replace(/[\s_]+/g, '-') .toLowerCase() } export function unescapeHtml(str: string): string { return str.replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, "'") .replace(/&/g, '&') } export function escapeHtml(str: string): string { return str.replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, ''') }