NewDash

    Function method

    • Creates a function that invokes the method at path of a given object. Any additional arguments are provided to the invoked method.

      Parameters

      • path: ArrayPath

        The path of the method to invoke.

      • ...args: any[]

        The arguments to invoke the method with.

      Returns any

      Returns the new invoker function.

      5.11.0

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

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

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