UNPKG

smart-case

Version:

JavaScript library that provides advanced string casing capabilities with intelligent capitalization handling. It offers a comprehensive set of features to convert strings to various casing styles, including title case, sentence case, camel case, snake ca

93 lines (92 loc) 3.94 kB
import { customRules } from "./smart-case.types"; /** * Converts a string to title case. * @param inputString - The string to convert. * @returns The title case string. * @example * titleCase("hello world"); // "Hello World" * titleCase("HELLO WORLD"); // "Hello World" * titleCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "Hello WORLD" */ export declare const titleCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to sentence case. * @param inputString - The string to convert. * @returns The sentence case string. * @example * sentenceCase("hello world"); // "Hello world" * sentenceCase("HELLO WORLD"); // "Hello world" * sentenceCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "Hello WORLD" * sentenceCase("hello world", { wordsToAlwaysLowerCase: ["hello"] }); // "hello world" */ export declare const sentenceCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to camel case. * @param inputString - The string to convert. * @returns The camel case string. * @example * camelCase("hello world"); // "helloWorld" * camelCase("HELLO WORLD"); // "helloWorld" * camelCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "helloWORLD" */ export declare const camelCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to pascal case. * @param inputString - The string to convert. * @returns The pascal case string. * @example * pascalCase("hello world"); // "HelloWorld" * pascalCase("HELLO WORLD"); // "HelloWorld" * pascalCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "HelloWORLD" */ export declare const pascalCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to snake case. * @param inputString - The string to convert. * @returns The snake case string. * @example * snakeCase("hello world"); // "hello_world" * snakeCase("HELLO WORLD"); // "hello_world" * snakeCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "hello_WORLD" */ export declare const snakeCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to kebab case. * @param inputString - The string to convert. * @returns The kebab case string. * @example * kebabCase("hello world"); // "hello-world" * kebabCase("HELLO WORLD"); // "hello-world" * kebabCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "hello-WORLD" */ export declare const kebabCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to constant case. * @param inputString - The string to convert. * @returns The constant case string. * @example * constantCase("hello world"); // "HELLO_WORLD" * constantCase("HELLO WORLD"); // "HELLO_WORLD" * constantCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "HELLO_WORLD" */ export declare const constantCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to dot case. * @param inputString - The string to convert. * @returns The dot case string. * @example * dotCase("hello world"); // "hello.world" * dotCase("HELLO WORLD"); // "hello.world" * dotCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "hello.WORLD" */ export declare const dotCase: (inputString: string, customRules?: customRules | undefined) => string; /** * Converts a string to path case. * @param inputString - The string to convert. * @returns The path case string. * @example * pathCase("hello world"); // "hello/world" * pathCase("HELLO WORLD"); // "hello/world" * pathCase("hello world", { wordsToAlwaysUpperCase: ["world"] }); // "hello/WORLD" */ export declare const pathCase: (inputString: string, customRules?: customRules | undefined) => string;