UNPKG

deep-case-crafter

Version:

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

20 lines (19 loc) 946 B
import { Expand } from '../types/helperTypes'; import { TransformOptionsInternal } from '../types/transformOptionTypes'; import { TransformArrayReturn } from '../types/transformTypes'; /** * Transforms all objects and Maps within an array (single level only) * * @param arr - The array to transform * @param options - Transformation options including targetCase (required) and optional sourceCase * @returns A new array with transformed items * * @remarks * - This function transforms keys in objects and Maps contained in the array * - Only transforms at the current level (not recursive) * - Non-object values in the array are kept as-is * - When sourceCase is specified, provides more precise type information * * @internal This function is for internal use by the library */ export default function transformArray<T extends unknown[], O extends TransformOptionsInternal>(arr: T, options: O): Expand<TransformArrayReturn<T, O>>;