Function hasAnyValue

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.

Having a comparer function is useful to check by value rather than object reference.

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.

  • Type Parameters

    • K
    • V

    Parameters

    • map: ReadonlyMap<K, V>

      Map to search

    • value: V

      Value to find

    • comparer: IsEqual<V>

      Function that determines matching. Should return true if a and b are considered equal.

    Returns boolean

    True if value is found