Options
All
  • Public
  • Public/Protected
  • All
Menu

Module nthArg

Index

References

Functions Util

References

Renames and re-exports nthArg

Util Functions

  • nthArg(n?: number): typeof nth
  • Creates a function that gets the argument at index n. If n is negative, the nth argument from the end is returned.

    since

    5.10.0

    example
    const func = nthArg(1)
    func('a', 'b', 'c', 'd')
    // => 'b'

    const func = nthArg(-2)
    func('a', 'b', 'c', 'd')
    // => 'c'

    Parameters

    • n: number = 0

      The index of the argument to return.

    Returns typeof nth

    Returns the new pass-thru function.