UNPKG

mapdtotoentity

Version:

A tiny typescript package to map data transfer objects to entity class. (Especially TypeOrm entities)

9 lines (8 loc) 197 B
export class mapDtoValuesToEntity<T, E> { map(DTOInstance: T, Entity: E): E { Object.keys(DTOInstance).forEach(key => { Entity[key] = DTOInstance[key]; }); return Entity; } }