Returns true if any key contains value, based on the provided comparer function. Use hasKeyValue if you only want to find a value under a certain key.
value
comparer
Having a comparer function is useful to check by value rather than object reference.
hasAnyValue(map, {name:`samantha`}, (a, b) => a.name === b.name); Copy
hasAnyValue(map, {name:`samantha`}, (a, b) => a.name === b.name);
Works by comparing value against all values contained in map for equality using the provided comparer.
map
Map to search
Value to find
Function that determines matching. Should return true if a and b are considered equal.
a
b
True if value is found
Returns true if any key contains
value
, based on the providedcomparer
function. Use hasKeyValue if you only want to find a value under a certain key.Having a comparer function is useful to check by value rather than object reference.
Example: Finds value where name is 'samantha', regardless of other properties
Works by comparing
value
against all values contained inmap
for equality using the providedcomparer
.