Options
All
  • Public
  • Public/Protected
  • All
Menu

Module method

Index

Functions Util

Util Functions

  • method(path: ArrayPath, ...args: any[]): any
  • Creates a function that invokes the method at path of a given object. Any additional arguments are provided to the invoked method.

    since

    5.11.0

    example
    const objects = [
    { 'a': { 'b': () => 2 } },
    { 'a': { 'b': () => 1 } }
    ]

    map(objects, method('a.b'))
    // => [2, 1]

    map(objects, method(['a', 'b']))
    // => [2, 1]

    Parameters

    • path: ArrayPath

      The path of the method to invoke.

    • Rest ...args: any[]

      The arguments to invoke the method with.

    Returns any

    Returns the new invoker function.