UNPKG

@tienedev/datype

Version:

Modern TypeScript utility library with pragmatic typing and zero dependencies

106 lines 2.91 kB
/** * Converts a string to camelCase. * * @param str - The string to convert * @returns A new string in camelCase format * * @example * ```typescript * import { camelCase } from 'datype'; * * camelCase('hello world'); // 'helloWorld' * camelCase('hello-world'); // 'helloWorld' * camelCase('hello_world'); // 'helloWorld' * camelCase('Hello World'); // 'helloWorld' * camelCase('HELLO WORLD'); // 'helloWorld' * ``` */ export declare function camelCase(str: string): string; /** * Converts a string to kebab-case. * * @param str - The string to convert * @returns A new string in kebab-case format * * @example * ```typescript * import { kebabCase } from 'datype'; * * kebabCase('hello world'); // 'hello-world' * kebabCase('helloWorld'); // 'hello-world' * kebabCase('hello_world'); // 'hello-world' * kebabCase('Hello World'); // 'hello-world' * kebabCase('HELLO WORLD'); // 'hello-world' * ``` */ export declare function kebabCase(str: string): string; /** * Converts a string to snake_case. * * @param str - The string to convert * @returns A new string in snake_case format * * @example * ```typescript * import { snakeCase } from 'datype'; * * snakeCase('hello world'); // 'hello_world' * snakeCase('helloWorld'); // 'hello_world' * snakeCase('hello-world'); // 'hello_world' * snakeCase('Hello World'); // 'hello_world' * snakeCase('HELLO WORLD'); // 'hello_world' * ``` */ export declare function snakeCase(str: string): string; /** * Converts a string to PascalCase. * * @param str - The string to convert * @returns A new string in PascalCase format * * @example * ```typescript * import { pascalCase } from 'datype'; * * pascalCase('hello world'); // 'HelloWorld' * pascalCase('hello-world'); // 'HelloWorld' * pascalCase('hello_world'); // 'HelloWorld' * pascalCase('helloWorld'); // 'HelloWorld' * ``` */ export declare function pascalCase(str: string): string; /** * Converts a string to CONSTANT_CASE (SCREAMING_SNAKE_CASE). * * @param str - The string to convert * @returns A new string in CONSTANT_CASE format * * @example * ```typescript * import { constantCase } from 'datype'; * * constantCase('hello world'); // 'HELLO_WORLD' * constantCase('helloWorld'); // 'HELLO_WORLD' * constantCase('hello-world'); // 'HELLO_WORLD' * constantCase('Hello World'); // 'HELLO_WORLD' * ``` */ export declare function constantCase(str: string): string; /** * Converts a string to dot.case. * * @param str - The string to convert * @returns A new string in dot.case format * * @example * ```typescript * import { dotCase } from 'datype'; * * dotCase('hello world'); // 'hello.world' * dotCase('helloWorld'); // 'hello.world' * dotCase('hello-world'); // 'hello.world' * dotCase('hello_world'); // 'hello.world' * ``` */ export declare function dotCase(str: string): string; //# sourceMappingURL=index.d.ts.map