source: node_modules/es-toolkit/dist/compat/function/rearg.d.mts@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 904 bytes
Line 
1import { Many } from '../_internal/Many.mjs';
2
3/**
4 * Creates a function that invokes `func` with arguments arranged according to the specified `indices`
5 * where the argument value at the first index is provided as the first argument,
6 * the argument value at the second index is provided as the second argument, and so on.
7 *
8 * @param {(...args: any[]) => any} func The function to rearrange arguments for.
9 * @param {Array<number | number[]>} indices The arranged argument indices.
10 * @returns {(...args: any[]) => any} Returns the new function.
11 *
12 * @example
13 * const greet = (greeting: string, name: string) => `${greeting}, ${name}!`;
14 * const rearrangedGreet = rearg(greet, 1, 0);
15 * console.log(rearrangedGreet('World', 'Hello')); // Output: "Hello, World!"
16 */
17declare function rearg(func: (...args: any[]) => any, ...indices: Array<Many<number>>): (...args: any[]) => any;
18
19export { rearg };
Note: See TracBrowser for help on using the repository browser.