CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
hasValue.d.ts29 linesDownload Raw Back to map
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 value5 * is equal to the search element using SameValueZero comparison (similar to6 * 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 * @example15 * const map = new Map([16 *   ['a', 1],17 *   ['b', 2],18 *   ['c', 3]19 * ]);20 * const result = hasValue(map, 2);21 * // result will be: true22 *23 * const result2 = hasValue(map, 5);24 * // result2 will be: false25 */26declare function hasValue<K, V>(map: Map<K, V>, searchElement: V): boolean;27 28export { hasValue };29 
basant307/AI_Governance_Project · CoolFace