source: node_modules/es-toolkit/dist/map/hasValue.d.ts

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

Added visualizations

  • Property mode set to 100644
File size: 887 bytes
Line 
1/**
2 * Checks if a Map contains a specific value.
3 *
4 * This function iterates through all values in the Map and checks if any value
5 * is equal to the search element using SameValueZero comparison (similar to
6 * Array.prototype.includes). This means that NaN is considered equal to NaN.
7 *
8 * @template K - The type of keys in the Map.
9 * @template V - The type of values in the Map.
10 * @param {Map<K, V>} map - The Map to search.
11 * @param {V} searchElement - The value to search for.
12 * @returns {boolean} true if the Map contains the value, false otherwise.
13 *
14 * @example
15 * const map = new Map([
16 * ['a', 1],
17 * ['b', 2],
18 * ['c', 3]
19 * ]);
20 * const result = hasValue(map, 2);
21 * // result will be: true
22 *
23 * const result2 = hasValue(map, 5);
24 * // result2 will be: false
25 */
26declare function hasValue<K, V>(map: Map<K, V>, searchElement: V): boolean;
27
28export { hasValue };
Note: See TracBrowser for help on using the repository browser.