source: node_modules/es-toolkit/dist/set/map.d.mts

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

Added visualizations

  • Property mode set to 100644
File size: 883 bytes
RevLine 
[a762898]1/**
2 * Creates a new Set with elements transformed by the provided function.
3 *
4 * This function takes a Set and a function that generates a new value from each element.
5 * It returns a new Set where the elements are the result of applying the function to each element.
6 *
7 * @template T - The type of elements in the input Set.
8 * @template U - The type of elements in the output Set.
9 * @param {Set<T>} set - The Set to transform.
10 * @param {(value: T, value2: T, set: Set<T>) => U} getNewValue - A function that generates a new value from an element.
11 * @returns {Set<U>} A new Set with transformed elements.
12 *
13 * @example
14 * const set = new Set([1, 2, 3]);
15 * const result = map(set, (value) => value * 2);
16 * // result will be:
17 * // Set(3) { 2, 4, 6 }
18 */
19declare function map<T, U>(set: Set<T>, getNewValue: (value: T, value2: T, set: Set<T>) => U): Set<U>;
20
21export { map };
Note: See TracBrowser for help on using the repository browser.