/** * Contains functions and types that translate string literals between cases and identifies their current case * @module */ import { type CamelCaseName, type IsCamelCase, type IsPascalCase, type PascalCaseName } from "./capitalization-delimited-cases.js"; import { type IsLowerCase, type IsUpperCase, type LowerCaseName, type UpperCaseName } from "./non-delimited-cases.js"; import { type IsKebabCase, type IsSnakeCase, type KebabCaseName, type SnakeCaseName } from "./symbol-delimited-cases.js"; import type { CaseName } from "./cases.js"; import { type StringToWords, type WordsToString } from "./words.js"; /** Translates a string literal type from one case to another */ export type ChangeStringCase = FromCase extends ToCase ? String : WordsToString>; /** Returns a function translating the string within an string. The current case will be auto-detected if possible. */ export declare function stringCaseChanger(toCase: ToCase): (string: String) => DetectCaseNameFromString extends infer FromCase extends CaseName ? ChangeStringCase : String; /** Returns a function translating the string within an string from one provided case to another */ export declare function stringCaseChanger(toCase: ToCase, fromCase: FromCase): (string: String) => ChangeStringCase; /** Translates a string from one case to another. The current case will be auto-detected if possible. */ export declare function changeStringCase(string: String, toCase: ToCase): DetectCaseNameFromString extends infer FromCase extends CaseName ? ChangeStringCase : String; /** Translates a string from one provided case to another. */ export declare function changeStringCase(string: String, toCase: ToCase, fromCase: FromCase): ChangeStringCase; /** Attempts to identify the current case of a string literal type and return a CaseName. Returns 'undefined' if unsuccesfull */ export type DetectCaseNameFromString = "" extends String ? undefined : IsSnakeCase extends true ? SnakeCaseName : IsKebabCase extends true ? KebabCaseName : IsCamelCase extends true ? CamelCaseName : IsPascalCase extends true ? PascalCaseName : IsLowerCase extends true ? LowerCaseName : IsUpperCase extends true ? UpperCaseName : undefined; /** Attempts to identify the current case of a string literal and return a CaseName. Returns 'undefined' if unsuccesfull */ export declare function detectCaseNameFromString(string: String): DetectCaseNameFromString; //# sourceMappingURL=string.d.ts.map