export const isImgUrl = (url: string): Promise => { const img = new Image(); img.src = url; return new Promise((resolve) => { img.onerror = () => resolve(false); img.onload = () => resolve(true); }); }; export const pluralize = (word: string, amount: number) => { return `${word}${amount === 1 ? '' : 's'}`; }; export const capitalizeFirstLetter = (string: string) => { return string.charAt(0).toUpperCase() + string.slice(1); }; const emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; export const isValidEmail = (email: string) => emailRegex.test(email);