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

CustomFieldMapper

Extends:

src/fieldMapper/field.mapper~FieldMapper → CustomFieldMapper

Constructor Summary

Public Constructor
public

constructor(builder: function(instance: Object, ?key: string, ?isList: boolean))

Uses a custom builder to produce the transformed value.

Member Summary

Private Members
private

Method Summary

Public Methods
public

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

Public Constructors

public constructor(builder: function(instance: Object, ?key: string, ?isList: boolean)) source

Uses a custom builder to produce the transformed value. Sometimes the src key is not needed, ie. in the case that the transformed value is derived from multiple keys on the instance

Params:

NameTypeAttributeDescription
builder function(instance: Object, ?key: string, ?isList: boolean)

the custom builder function. Must take at least one argument (instance)

Private Members

private _builder: * source

Public Methods

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

Params:

NameTypeAttributeDescription
instance Object

the source object.

key string
  • nullable: true

a key on the source object that can be used to retrieve the field value.

isList boolean
  • nullable: true

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

Return:

Promise

a Promise that resolves to the transformed value.