export function sanitize(str: string): string { return str.replaceAll(' ', '_') } export function capitalize(str: string): string { return str .split(' ') .map(word => word.split('')) .map(([firstLetter, ...tail]) => `${firstLetter.toLocaleUpperCase()}${tail.join().toLocaleLowerCase()}`) .join(' ') } export function toLogin(firstname: string, lastname: string): string { return `${sanitize(firstname.toLocaleLowerCase())}.${sanitize(lastname.toLocaleLowerCase())}` }