UNPKG

@byloth/core

Version:

An unopinionated collection of useful functions and classes that I use widely in all my projects. 🔧

21 lines (20 loc) • 340 B
/** * Capitalize the first letter of a string. * * --- * * @example * ```ts * capitalize('hello'); // 'Hello' * ``` * * --- * * @param value The string to capitalize. * * @returns The capitalized string. */ export function capitalize(value: string): string { return `${value.charAt(0).toUpperCase()}${value.slice(1)}`; }