Getting started
interface CustomerDto {
firstName: string;
lastName: string;
}
interface Customer {
firstName: string;
lastName: string;
fullName: string;
}import { MappingPair } from '@dynamic-mapper/mapper';
const CustomerDtoToCustomer = new MappingPair<CustomerDto, Customer>();Mapping configuration
import { MapperConfiguration } from '@dynamic-mapper/mapper';
const configuration = new MapperConfiguration(cfg => {
cfg.createAutoMap(CustomerDtoToCustomer, {
fullName: opt => opt.mapFrom(src => `${src.firstName} ${src.lastName}`)
});
});Mapping
Last updated
Was this helpful?