UNPKG

text-case-converter

Version:

[DEPRECATED] A modern TypeScript library to convert strings between various case formats (camelCase, PascalCase, snake_case, etc.).

45 lines (42 loc) 1.57 kB
type CaseType = 'camelCase' | 'PascalCase' | 'snake_case' | 'kebab-case' | 'CONSTANT_CASE'; /** * Converts an input string to camelCase. * e.g., "hello world" -> "helloWorld" * @param input The string to convert. * @returns The camelCased string. * @throws {TypeError} If input is not a string. */ declare function toCamelCase(input: string): string; /** * Converts an input string to PascalCase (UpperCamelCase). * e.g., "hello world" -> "HelloWorld" * @param input The string to convert. * @returns The PascalCased string. * @throws {TypeError} If input is not a string. */ declare function toPascalCase(input: string): string; /** * Converts an input string to snake_case. * e.g., "hello world" -> "hello_world" * @param input The string to convert. * @returns The snake_cased string. * @throws {TypeError} If input is not a string. */ declare function toSnakeCase(input: string): string; /** * Converts an input string to kebab-case. * e.g., "hello world" -> "hello-world" * @param input The string to convert. * @returns The kebab-cased string. * @throws {TypeError} If input is not a string. */ declare function toKebabCase(input: string): string; /** * Converts an input string to CONSTANT_CASE (SCREAMING_SNAKE_CASE). * e.g., "hello world" -> "HELLO_WORLD" * @param input The string to convert. * @returns The CONSTANT_CASED string. * @throws {TypeError} If input is not a string. */ declare function toConstantCase(input: string): string; export { type CaseType, toCamelCase, toConstantCase, toKebabCase, toPascalCase, toSnakeCase };