@nerdware/ddb-single-table
Version:
A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡
17 lines • 1.13 kB
TypeScript
import type { SupportedAttributeValueType } from "../types/index.js";
/**
* A fn that converts a value from one type to another.
* If no conversion is applied, it should return `undefined`.
* @see {@link getRecursiveValueConverter}
*/
export type ValueConverterFn<Result extends SupportedAttributeValueType = SupportedAttributeValueType> = (value: SupportedAttributeValueType) => Result;
/**
* This function creates a recursive value converter that applies the provided `valueConverter`
* to all non-falsy values in the input object or array.
*
* @template AllowedReturnTypes - Union of allowed return types for the `valueConverter` function.
* @param valueConverter - A fn that returns a converted-value OR `undefined` if no conversion was applied.
* @returns A function that recursively applies value-conversion to its `value` parameter.
*/
export declare const getRecursiveValueConverter: <AllowedReturnTypes extends SupportedAttributeValueType>(valueConverter: ValueConverterFn<AllowedReturnTypes | undefined>) => ValueConverterFn<SupportedAttributeValueType>;
//# sourceMappingURL=getRecursiveValueConverter.d.ts.map