Home Reference Source
import {FieldMapper} from 'tilla/src/fieldMapper/field.mapper.js'
public class | source

FieldMapper

Method Summary

Public Methods
public

builder(): *

This method must be implemented by all mappers.

public

map(instance: Object, key: string, isList: boolean): Promise

Call the builder passing in the instance, key on the instance to transform and the isList flag.

Public Methods

public builder(): * source

This method must be implemented by all mappers. Otherwise, an error is thrown

Return:

*

Throw:

Error

throw when this method isn't implemented

public map(instance: Object, key: string, isList: boolean): Promise source

Call the builder passing in the instance, key on the instance to transform and the isList flag. Calls to the builder are wrapped in a Promise to ensure a Promise is always returned.

Params:

NameTypeAttributeDescription
instance Object

the source object.

key string
  • optional

the key to provide to the builder.

isList boolean
  • optional

whether the value being transformed should be iterated into the builder.

Return:

Promise

the transformed value.