@automapper/core

esm cjs
AutoMapper TypeScript Core
Version 8.8.1 License MIT
Keywords
typescriptautomappermappernx
INSTALL
Type:
Version:
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 8.8.1
- 8.8.0
- 8.7.7
- 8.7.6
- 8.7.5
- 8.7.4
- 8.7.3
- 8.7.2
- 8.7.1
- 8.7.0
- 8.6.0
- 8.5.1
- 8.5.0
- 8.4.1
- 8.4.0
- 8.3.7
- 8.3.6
- 8.3.5
- 8.3.4
- 8.3.3
- 8.3.2
- 8.3.1
- 8.3.0
- 8.2.4
- 8.2.3
- 8.2.2
- 8.2.1
- 8.2.0
- 8.1.0
- 8.0.1
- 8.0.0
- 7.3.14
- 7.3.13
- 7.3.12
- 7.3.11
- 7.3.10
- 7.3.9
- 7.3.8
- 7.3.7
- 7.3.6
- 7.3.5
- 7.3.4
- 7.3.3
- 7.3.2
- 7.3.1
- 7.3.0
- 7.2.1
- 7.2.0
- 7.1.1
- 7.1.0
- 7.0.3
- 7.0.2
- 7.0.1
- 7.0.0
- 6.3.1
- 6.3.0
- 6.2.1
- 6.2.0
- 6.1.4
- 6.1.3
- 6.1.2
- 6.1.1
- 6.1.0
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.1
- 5.0.0
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.2
- 3.0.1
- 3.0.0
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 8.5.0-beta.0
- 8.3.7-beta.0
- 8.1.0-beta.0
- 8.0.1-beta.1
- 8.0.1-beta.0
- 8.0.0-beta.18
- 8.0.0-beta.17
- 8.0.0-beta.16
- 8.0.0-beta.15
- 8.0.0-beta.14
- 8.0.0-beta.13
- 8.0.0-beta.12
- 8.0.0-beta.10
- 8.0.0-beta.9
- 8.0.0-beta.8
- 8.0.0-beta.7
- 8.0.0-beta.6
- 8.0.0-beta.5
- 8.0.0-beta.4
- 8.0.0-beta.3
- 8.0.0-beta.2
- 8.0.0-beta.1
- 8.0.0-beta.0
- 1.0.0-beta.9
- 1.0.0-beta.8
- 1.0.0-beta.7
- 1.0.0-beta.6
- 1.0.0-beta.5
- 1.0.0-beta.4
- 1.0.0-beta.3
- 1.0.0-beta.2
- 1.0.0-beta.1
<script type="module"> import automappercore from 'https://cdn.jsdelivr.net/npm/@automapper/core@8.8.1/+esm' </script>
@automapper/core
This is the core package that will handle mapping configurations and mapping operations.
Installation
npm i @automapper/core
or with yarn
yarn add @automapper/core
Usage
@automapper/core
exposes createMapper()
method to create a Mapper
object with a accompany MappingStrategy
(read more
about Strategies)
createMapper
accepts a CreateMapperOptions
object with the following shape:
export interface CreateMapperOptions {
strategyInitializer: MappingStrategyInitializer<MetadataIdentifier>;
errorHandler?: ErrorHandler;
namingConventions?: NamingConventionInput;
}
Read more about usage on documentation site
Strategies
A given Mapper is accompanied by a Strategy by providing strategyInitializer
when using createMapper()
.
A Strategy will be responsible for:
- Discover metadata (eg:
classes
uses@AutoMap()
decorator to discover the metadata of the properties on the Classes) - Retrieve metadata: how the metadata should be retrieved from the discovery phase (eg:
classes
discovers and stores the metadata toReflect
, retrieve metadata simply gets them fromReflect
) - Apply metadata: how the metadata is applied to the Model
@automapper
provides the following official strategies:
@automapper/classes
: Work with TS/ES6 classes.@automapper/pojos
: Work with Interfaces/Types along with POJOs. In projects that do not make use of Class,pojos
can be used instead.@automapper/mikro
: Work together with TS/ES6 classes along with MikroORM@automapper/sequelize
: Work together with TS/ES6 classes along with Sequelize