Options
All
  • Public
  • Public/Protected
  • All
Menu

This function will be called by transformKeys with the matching property value of the object being transformed and the entire source object being transformed as its second arg.

see

transformKeys

see

[[keyTransformer]]

Hierarchy

  • KeyTransformerFun

Callable

  • __call(arg: any, srcObj?: object): any
  • ``` const transformName = (name, srcObj) => Hello, ${name} const transformMember = (member, srcObj) => !!srcObj.name === 'Bob' // Reference the source object const transformOwes = (owes, srcObj) => Promise.resolve(owes + 100), // Return promises or values const transformValid = (valid, srcObj) => throw new Error('Sorry'), // Exits the transformer. Will throw upward. const transformConstant = 10000 // Resulting object will always contain this value.

    const transformer: KeyTransformer = { name: transformName , member: transformMember, owes: transformOwes, valid: transformValid some_constant: transformConstant }

    Parameters

    • arg: any

      The property matching value from the object being transformed.

    • Optional srcObj: object

      The entire object being transformed.

    Returns any

    Promise, Error, or value

Legend

  • Constructor
  • Property
  • Inherited property
  • Static property

Generated using TypeDoc