|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
511 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Creates a function that accepts up to one argument, ignoring any additional arguments.
|
|---|
| 3 | *
|
|---|
| 4 | * @template F - The type of the function.
|
|---|
| 5 | * @param {F} func - The function to cap arguments for.
|
|---|
| 6 | * @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
|
|---|
| 7 | *
|
|---|
| 8 | * @example
|
|---|
| 9 | * function fn(a, b, c) {
|
|---|
| 10 | * console.log(arguments);
|
|---|
| 11 | * }
|
|---|
| 12 | *
|
|---|
| 13 | * unary(fn)(1, 2, 3); // [Arguments] { '0': 1 }
|
|---|
| 14 | */
|
|---|
| 15 | declare function unary<T, U>(func: (arg1: T, ...args: any[]) => U): (arg1: T) => U;
|
|---|
| 16 |
|
|---|
| 17 | export { unary };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.