Function overArgs

  • Creates a function that invokes func with its arguments transformed.

    Parameters

    • func: Function

      The function to wrap.

    • transforms: Function[]

      The argument transforms.

    Returns Function

    Returns the new function.

    5.11.0

    function doubled(n) {
    return n * 2
    }

    function square(n) {
    return n * n
    }

    const func = overArgs((x, y) => [x, y], [square, doubled])

    func(9, 3)
    // => [81, 6]

    func(10, 5)
    // => [100, 10]