Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Function

Extends the built-in javascript Function object's prototype.

The Format.Config.addUtilsToPrototype method must be called in order to access the definitions.

Hierarchy

  • Function

Index

Properties

Methods

Properties

cache

cache: Indexable<Object>

If the function is memoized, contains the current function calls' cached results.

Methods

getName

  • getName(): string

getReturnName

  • getReturnName(): string
  • Returns the rightmost accessor's name of the function's first returned variable.

    For example a return expression like return this.field; will yield "field" as a value.

    Must call Format.Config.addUtilsToPrototype to be defined.

    Returns string

    The text of the last literal contained in the first return expression of the function.

memoize

  • memoize(resolver?: function): Function
  • Returns a memoized function wrapper of the function. All calls with the same arguments to the original function are cached after the first use.

    Must call Format.Config.addUtilsToPrototype to be defined.

    Parameters

    • Optional resolver: function

      A cache key resolver function used to store the call arguments' list as a string key. Defaults to JSON.stringify.

        • (argumentValues: Object[]): string
        • Parameters

          • argumentValues: Object[]

            An array containing the call arguments for the function.

          Returns string

    Returns Function

Generated using TypeDoc