Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

Protected _mappings

_mappings: object

Type declaration

Private _profiles

_profiles: object

Type declaration

Static Private _instance

_instance: AutoMapper = new AutoMapper()

Methods

Private _createMapForMember

Private _createMapForPath

Private _createMappingFluentFunctions

Protected _createMappingObject

Private _createReverseMap

Protected _createReverseMappingObject

  • _createReverseMappingObject<TSource, TDestination>(mapping: Mapping<TSource, TDestination>): Mapping<TDestination, TSource>

Protected _dispose

  • _dispose(): void

Protected _getKeyFromMemberFn

Protected _getMapping

Protected _getMappingForDestination

  • _getMappingForDestination<TSource, TDestination>(destination: Constructable<TDestination>): Mapping<TSource, TDestination>

Protected _map

  • _map<TSource, TDestination>(sourceObj: TSource, mapping: Mapping<TSource, TDestination>, option?: MapActionOptions<TSource, TDestination>, isArrayMap?: boolean): TDestination
  • Type parameters

    • TSource: object

    • TDestination: object

    Parameters

    • sourceObj: TSource
    • mapping: Mapping<TSource, TDestination>
    • Default value option: MapActionOptions<TSource, TDestination> = { beforeMap: undefined, afterMap: undefined }
    • Default value isArrayMap: boolean = false

    Returns TDestination

Protected _mapArray

  • _mapArray<TSource, TDestination>(sourceArray: TSource[], mapping: Mapping<TSource, TDestination>, option?: MapActionOptions<TSource[], TDestination[]>): TDestination[]
  • Type parameters

    • TSource: object

    • TDestination: object

    Parameters

    • sourceArray: TSource[]
    • mapping: Mapping<TSource, TDestination>
    • Default value option: MapActionOptions<TSource[], TDestination[]> = {beforeMap: undefined,afterMap: undefined}

    Returns TDestination[]

Protected _mapArrayAsync

  • _mapArrayAsync<TSource, TDestination>(sourceArray: TSource[], mapping: Mapping<TSource, TDestination>, option?: MapActionOptions<TSource[], TDestination[]>): Promise<TDestination[]>
  • Type parameters

    • TSource: object

    • TDestination: object

    Parameters

    • sourceArray: TSource[]
    • mapping: Mapping<TSource, TDestination>
    • Default value option: MapActionOptions<TSource[], TDestination[]> = {beforeMap: undefined,afterMap: undefined}

    Returns Promise<TDestination[]>

Protected _mapAsync

  • _mapAsync<TSource, TDestination>(sourceObj: TSource, mapping: Mapping<TSource, TDestination>, option?: MapActionOptions<TSource, TDestination>): Promise<TDestination>
  • Type parameters

    • TSource: object

    • TDestination: object

    Parameters

    • sourceObj: TSource
    • mapping: Mapping<TSource, TDestination>
    • Default value option: MapActionOptions<TSource, TDestination> = {beforeMap: undefined,afterMap: undefined}

    Returns Promise<TDestination>

addProfile

createMap

  • Create a mapping between Source and Destination without initializing the Mapper

    Type parameters

    • TSource: __type

    • TDestination: __type

    Parameters

    Returns CreateMapFluentFunctions<TSource, TDestination>

dispose

  • dispose(): void
  • Dispose Mappings and Profiles created on the Mapper singleton

    Returns void

Protected getTransformationType

initialize

  • initialize(configFn: function): void
  • Initialize Mapper

    example
    Mapper.initialize(config => {
      config.addProfile(new Profile());
      config.createMap(Source, Destination);
    })

    Parameters

    Returns void

map

  • map<TSource, TDestination>(sourceObj: TSource, destination: Constructable<TDestination>, option?: MapActionOptions<TSource, TDestination>): TDestination
  • Map from Source to Destination

    example
    const user = new User();
    user.firstName = 'John';
    user.lastName = 'Doe';
    
    const userVm = Mapper.map(user, UserVm);

    Type parameters

    • TSource: __type

    • TDestination: __type

    Parameters

    • sourceObj: TSource

      the sourceObj that are going to be mapped

    • destination: Constructable<TDestination>

      the Destination model to receive the mapped values

    • Optional option: MapActionOptions<TSource, TDestination>

      Optional mapping option

    Returns TDestination

mapArray

  • mapArray<TSource, TDestination>(sourceObj: TSource[], destination: Constructable<TDestination>, option?: MapActionOptions<TSource[], TDestination[]>): TDestination[]
  • Map from a list of Source to a list of Destination

    example
    const addresses = [];
    addresses.push(new Address(), new Address());
    
    const addressesVm = Mapper.mapArray(addresses, AddressVm);

    Type parameters

    • TSource: __type

    • TDestination: __type

    Parameters

    • sourceObj: TSource[]

      the sourceObj that are going to be mapped

    • destination: Constructable<TDestination>

      the Destination model to receive the mapped values

    • Optional option: MapActionOptions<TSource[], TDestination[]>

      Optional mapping option

    Returns TDestination[]

mapArrayAsync

  • mapArrayAsync<TSource, TDestination>(sourceObj: TSource[], destination: Constructable<TDestination>, option?: MapActionOptions<TSource[], TDestination[]>): Promise<TDestination[]>
  • Map from a list of Source to a list of Destination async. Mapping operation will be run as a micro task.

    example
    const addresses = [];
    addresses.push(new Address(), new Address());
    
    const addressesVm = await Mapper.mapArrayAsync(addresses, AddressVm);

    Type parameters

    • TSource: __type

    • TDestination: __type

    Parameters

    • sourceObj: TSource[]

      the sourceObj that are going to be mapped

    • destination: Constructable<TDestination>

      the Destination model to receive the mapped values

    • Optional option: MapActionOptions<TSource[], TDestination[]>

      Optional mapping option

    Returns Promise<TDestination[]>

    Promise that resolves a TDestination[]

mapAsync

  • mapAsync<TSource, TDestination>(sourceObj: TSource, destination: Constructable<TDestination>, option?: MapActionOptions<TSource, TDestination>): Promise<TDestination>
  • Map from Source to Destination Async. Mapping operation will be run as a micro task.

    example
    const user = new User();
    user.firstName = 'John';
    user.lastName = 'Doe';
    
    const userVm = await Mapper.mapAsync(user, UserVm);

    Type parameters

    • TSource: __type

    • TDestination: __type

    Parameters

    • sourceObj: TSource

      the sourceObj that are going to be mapped

    • destination: Constructable<TDestination>

      the Destination model to receive the mapped values

    • Optional option: MapActionOptions<TSource, TDestination>

      Optional mapping option

    Returns Promise<TDestination>

    Promise that resolves TDestination

Static getInstance

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc