@automapper/pojos

AutoMapper TypeScript POJOs plugin

Usage no npm install needed!

<script type="module">
  import automapperPojos from 'https://cdn.skypack.dev/@automapper/pojos';
</script>

README

@automapper/pojos

This is the official plugin from @automapper to work with Interfaces/Types along with Plain Objects

Installation

npm i @automapper/pojos

or with yarn:

yarn add @automapper/pojos

peerDependencies

@automapper/pojos depends on @automapper/core and @automapper/types

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

or with yarn:

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

Usage

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

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

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

mapper.createMap<User, UserVm>('SomeTokenForUser', 'SomeTokenForUserVm');
mapper.map<User, UserVm>(user, 'SomeTokenForUserVm', 'SomeTokenForUser');

Read more about this plugin on pojos documentation