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()) }` } export const log = { info(message: string) { console.log( `%c[info]%c ${message}`, 'color: cyan; font-weight: bold', 'color: white', ) }, error(message: string) { console.error( `%c[error]%c ${message}`, 'color: red; font-weight: bold', 'color: white', ) }, }