|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
496 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates a function that gets the argument at index `n`. If `n` is negative, the nth argument from the end is returned.
|
|---|
| 3 | *
|
|---|
| 4 | * @param {number} [n=0] - The index of the argument to return.
|
|---|
| 5 | * @returns {(...args: any[]) => any} Returns the new function.
|
|---|
| 6 | *
|
|---|
| 7 | * @example
|
|---|
| 8 | * var func = nthArg(1);
|
|---|
| 9 | * func('a', 'b', 'c', 'd');
|
|---|
| 10 | * // => 'b'
|
|---|
| 11 | *
|
|---|
| 12 | * var func = nthArg(-2);
|
|---|
| 13 | * func('a', 'b', 'c', 'd');
|
|---|
| 14 | * // => 'c'
|
|---|
| 15 | */
|
|---|
| 16 | declare function nthArg(n?: number): (...args: any[]) => any;
|
|---|
| 17 |
|
|---|
| 18 | export { nthArg };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.