Data Transformer Array-map

Edit on GitHub

This document explains the Data Transformer Array-map service in the Components Library.


Data Transformer Array-map is an Angular Service that executes another Data Transformer based on the config for every element in the array.

In the example below, the datasource will return an array with the transformed date in every object.

Service configuration:

  • mapItems - a Data Transformer that is set up with a configuration object.
        type: 'inline',
        data: [
                type: 'date',
                date: '2020-09-24T15:20:08+02:00',
                type: 'date',
                date: '2020-09-24T15:20:08+02:00',
        transform: {
            type: 'array-map',
            mapItems: {
                type: 'lens',
                path: 'date',
                transformer: {
                    type: 'date-parse',

Service registration

Register the service:

    imports: [
            'array-map': ArrayMapDataTransformerService,
export class RootModule {}


Below you can find interfaces for the Data Transformer Array-map:

declare module '@spryker/data-transformer' {
    interface DataTransformerRegistry {
        'array-map': ArrayMapDataTransformerConfig;

export interface ArrayMapDataTransformerConfig extends DataTransformerConfig {
    mapItems: DataTransformerConfig;