import { plainToClass } from 'class-transformer' ; export class Mapper < E , D > { constructor ( private entityClass , private dtoClass ) { } toDto ( entityObject ) { return plainToClass < D , Partial < E > > ( this . dtoClass , entityObject , { excludeExtraneousValues : true , } ) ; } async toDtoAsync ( entityObject ) { return plainToClass < D , Partial < E > > ( this . dtoClass , entityObject , { excludeExtraneousValues : true , } ) ; } toDtoList ( entityArray ) { return plainToClass < D , E > ( this . dtoClass , entityArray , { excludeExtraneousValues : true , } ) ; } toEntity ( dtoObject ) { return plainToClass < E , Partial < D > > ( this . entityClass , dtoObject , { excludeExtraneousValues : true , } ) ; } toEntityList ( dtoArray ) { return plainToClass < E , D > ( this . entityClass , dtoArray , { excludeExtraneousValues : true , } ) ; } }