variable mapFromAsync

Provides convenience functions for object mappers.

Use these to map to constant values, or to omit the property.

Methods

constant<TValue>(
this: void,
value: TValue
): () => Promise<TValue>

Returns a function that always returns a constant value.

const objectMapperSchema = {
  out: mapFrom.constant('Hello'),
}
omit(this: void): Promise<OmitProperty>

Returns the symbol OmitProperty, which will tell the mapper to omit the property from the output object.

const objectMapperSchema = {
  out: mapFrom.omit,
}
null(this: void): Promise<null>

Always map the output value to null

const objectMapperSchema = {
  out: mapFrom.null,
}
undefined(this: void): Promise<undefined>

Always map the output value to undefined

const objectMapperSchema = {
  out: mapFrom.undefined,
}

Usage

import { mapFromAsync } from ".";