UNPKG

@maddimathon/utility-typescript

Version:

TypeScript utilities (types, functions, classes) to use in various projects.

24 lines (23 loc) 457 B
/** * @since 0.1.0 * * @packageDocumentation */ /*! * @maddimathon/utility-typescript@2.0.0-beta.5 * @license MIT */ /** * Converts the given string to title case. * * @category Functions – String * * @param input String to convert. * * @return Title case version of the input string. * * @source */ export function toTitleCase(input) { return input.replace(/\w\S*/g, (s) => s.charAt(0).toUpperCase() + s.slice(1).toLowerCase()); }