Poq.SDK.Node

Home > @poq/transform > Transformer > toType

Transformer.toType() method

Method transforms plain javascript objects into array of typed instances defined by constructor of class.

Signature:

static toType<T>(plainObjs: PlainObj[], ctor: Ctor<T>, options?: TransformOptions): T[];

Parameters

Parameter Type Description
plainObjs PlainObj[] Defines javascript object to transform into instance of specific type.
ctor Ctor<T> Defines class/type constructor.
options TransformOptions (Optional)

Returns:

T[]

Array of instance of class/type.