Skip to main content

Mutation

AutoMapper provides a way to map mutably using the mutate() API (and its variants)

mapper.map();
mapper.mapAsync();
mapper.mapArray();
mapper.mapArrayAsync();

mapper.mutate();
mapper.mutateAsync();
mapper.mutateArray();
mapper.mutateArrayAsync();

The mutate() API returns void as we would pass in the destinationObject to mutate

// map()
const dto = mapper.map(user, User, UserDto);

// mutate()
let dto = {};
mapper.mutate(user, dto, User, UserDto);