source: node_modules/es-toolkit/dist/function/ary.d.mts@ ba17441

Last change on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 694 bytes
Line 
1/**
2 * Creates a function that invokes func, with up to n arguments, ignoring any additional arguments.
3 *
4 * @template F - The type of the function.
5 * @param {F} func - The function to cap arguments for.
6 * @param {number} n - The arity cap.
7 * @returns {(...args: any[]) => ReturnType<F>} Returns the new capped function.
8 *
9 * @example
10 * function fn(a: number, b: number, c: number) {
11 * return Array.from(arguments);
12 * }
13 *
14 * ary(fn, 0)(1, 2, 3) // []
15 * ary(fn, 1)(1, 2, 3) // [1]
16 * ary(fn, 2)(1, 2, 3) // [1, 2]
17 * ary(fn, 3)(1, 2, 3) // [1, 2, 3]
18 */
19declare function ary<F extends (...args: any[]) => any>(func: F, n: number): (...args: any[]) => ReturnType<F>;
20
21export { ary };
Note: See TracBrowser for help on using the repository browser.