UNPKG

deep-case-crafter

Version:

Transforms deeply nested object, array, Map, and Set keys between common case formats while preserving TypeScript type safety

22 lines (21 loc) 920 B
import { StringCase } from '../types/stringCaseTypes'; /** * A mapping of transformation functions for converting strings between different case formats. * * Each key of this mapping represents the detected source case (e.g., 'snake', 'camel', 'pascal', 'kebab'). * The corresponding value is an object that maps target case formats to the appropriate transformation function. * * Each transformation function accepts a string (`str`) that is to be transformed. * * For instance: * - `formatterMap.snake.camel` converts a snake_case string to camelCase. * - If the source and target cases are the same (e.g., `formatterMap.snake.snake`), an identity function is provided. * * @type {Record<StringCase, Record<StringCase, (str: string) => string>>} */ declare const formatterMap: { [source in StringCase]: { [target in StringCase]: (str: string) => string; }; }; export default formatterMap;