UNPKG

@cc-heart/utils

Version:

🔧 javascript common tools collection

18 lines (16 loc) • 580 B
/** * Capitalizes the first letter of a string. * * @param target - The string to be capitalized. * @return - The capitalized string. */ export const capitalize = <T extends string>(target: T) => (target.charAt(0).toUpperCase() + target.slice(1)) as Capitalize<T> /** * Returns a new string with the first character converted to lowercase. * * @param target - The string to be unCapitalized. * @returns - The unCapitalized string. */ export const unCapitalize = <T extends string>(target: T) => (target.charAt(0).toLowerCase() + target.slice(1)) as Uncapitalize<T>