Function invoke

  • Invokes the method at path of object.

    Parameters

    • object: any

      The object to query.

    • path: any

      The path of the method to invoke.

    • Rest ...args: any[]

      The arguments to invoke the method with.

      Rest

    Returns any

    Returns the result of the invoked method.

    Since

    5.7.0

    Example

    const object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] }

    invoke(object, 'a[0].b.c.slice', [1, 3])
    // => [2, 3]