transformable
Version:
Transforms plain objects to class instances and vice versa (a lightweight alternative to 'class-transformer')
11 lines (10 loc) • 311 B
TypeScript
export type AttributeTransformationMap = Map<string, Transformation>;
export type Transformation = {
input?: Transformer;
output?: Transformer;
};
export type Transformer = (value: any, context: TransformerContext) => any;
export type TransformerContext = {
source?: string;
target?: string;
};