Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1008 Bytes

README.md

File metadata and controls

50 lines (34 loc) · 1008 Bytes

@automapper/classes

This is the official plugin from @automapper to work with TS/ES6 Class

Installation

npm i @automapper/classes

or with yarn:

yarn add @automapper/classes

peerDependencies

@automapper/classes depends on @automapper/core, @automapper/types, and reflect-metadata.

npm i @automapper/core reflect-metadata
npm i --save-dev @automapper/types

or with yarn:

yarn add @automapper/core reflect-metadata
yarn add --dev @automapper/types

Usage

@automapper/classes provides classes as a MapPluginInitializer. Pass classes to createMapper to create a Mapper that uses classes plugin.

import { classes } from '@automapper/classes';

const mapper = createMapper({
  ...,
  pluginInitializer: classes
})

mapper.createMap(User, UserVm);
mapper.map(user, UserVm, User);

Read more about this plugin on classes documentation