Options
All
  • Public
  • Public/Protected
  • All
Menu

Module overArgs

Index

References

Functions Function

References

Renames and re-exports __type

Function Functions

  • overArgs(func: Function, transforms: Function[]): Function
  • Creates a function that invokes func with its arguments transformed.

    since

    5.11.0

    example
    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]

    Parameters

    • func: Function

      The function to wrap.

    • transforms: Function[]

      The argument transforms.

    Returns Function

    Returns the new function.