Poq.SDK.Node

Home > @poq/transform > Transformer

Transformer class

Transformer class includes different helpers to transform plain objects into typed and back.

Signature:

export declare class Transformer 

Remarks

Transformer class is static and can be used to inherit from it.

Properties

Property Modifiers Type Description
Property static (config?: TransformerConfig<any, any>) => PropertyDecorator Decorator is used to mark properties of class/type as important to transform.
Transformable static (options?: TransformOptions) => ClassDecorator Decorator is used to mark class/type as transformable.

Methods

Method Modifiers Description
deserialize(json, ctor, options) static Method deserializes json string into type instance.
precompile() static Method precompiles transformation functions for all defined transformable classes.
toPlain(typedElements, options) static Method transforms array of typed objects into plain javascript objects.
toPlain(typedElement, options) static Method transforms typed object into plain javascript object.
toType(plainObjs, ctor, options) static Method transforms plain javascript objects into array of typed instances defined by constructor of class.
toType(plainObj, ctor, options) static Method transforms plain javascript object into instance of type defined by constructor of class.