deep-case-crafter
Version:
Transforms deeply nested object, array, Map, and Set keys between common case formats while preserving TypeScript type safety
24 lines (23 loc) • 907 B
TypeScript
import { TransformOptionsInternal } from '../types/transformOptionTypes';
/**
* Transforms a string from one case format to another.
*
* @param str - The string to transform
* @param options - Transformation options
* @param options.targetCase - The target case format to transform to
* @param options.sourceCase - Optional source case format. If provided, skips detection
*
* @returns The transformed string, or the original string if transformation is not possible
*
* @example
* // With automatic source detection
* transformCase('hello_world', { targetCase: 'camel' })
* // => 'helloWorld'
*
* // With explicit source case
* transformCase('HelloWorld', { targetCase: 'snake', sourceCase: 'pascal' })
* // => 'hello_world'
*
* @internal This function is for internal use by the library
*/
export default function transformCase(str: string, options: TransformOptionsInternal): string;