string-utils-lite
Version:
Tiny string helpers: capitalize, titleCase, kebab-case, snake_case, camelCase, and PascalCase.
21 lines (19 loc) • 717 B
TypeScript
/**
* Capitalise only the first letter; rest lowercase.
* "hELLo" -> "Hello"
*/
declare function capitalize(str?: string): string;
/**
* Title case: capitalise first letter of each word.
* Preserves spacing by splitting on whitespace tokens.
*/
declare function titleCase(str?: string): string;
/** Convert to kebab-case. */
declare function toKebabCase(str?: string): string;
/** Convert to snake_case. */
declare function toSnakeCase(str?: string): string;
/** Convert to camelCase. */
declare function toCamelCase(str?: string): string;
/** Convert to PascalCase. */
declare function toPascalCase(str?: string): string;
export { capitalize, titleCase, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };