source: node_modules/es-toolkit/dist/compat/array/invokeMap.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: 1.2 KB
Line 
1/**
2 * Invokes the method at path of each element in collection.
3 *
4 * @param {object | null | undefined} collection - The collection to iterate over.
5 * @param {string} methodName - The name of the method to invoke.
6 * @param {...any[]} args - The arguments to invoke each method with.
7 * @returns {any[]} Returns the array of results.
8 *
9 * @example
10 * invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
11 * // => [[1, 5, 7], [1, 2, 3]]
12 *
13 * invokeMap([123, 456], 'toString', 2);
14 * // => ['1111011', '111001000']
15 */
16declare function invokeMap(collection: object | null | undefined, methodName: string, ...args: any[]): any[];
17/**
18 * Invokes the method at path of each element in collection.
19 *
20 * @template R
21 * @param {object | null | undefined} collection - The collection to iterate over.
22 * @param {(...args: any[]) => R} method - The method to invoke.
23 * @param {...any[]} args - The arguments to invoke each method with.
24 * @returns {R[]} Returns the array of results.
25 *
26 * @example
27 * invokeMap([5, 1, 7], Array.prototype.slice, 1);
28 * // => [[], [], []]
29 */
30declare function invokeMap<R>(collection: object | null | undefined, method: (...args: any[]) => R, ...args: any[]): R[];
31
32export { invokeMap };
Note: See TracBrowser for help on using the repository browser.