Skip to content

hasValue

Subhajit Sahu edited this page Dec 5, 2022 · 11 revisions

Check if map has a value.

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: randomValue, values, hasValue.


function hasValue(x, v, fc, fm)
// x:  a map
// v:  search value
// fc: compare function (a, b)
// fm: map function (v, k, x)
const map = require('extra-map');

var x = new Map([['a', 1], ['b', 2], ['c', -3]]);
map.hasValue(x, 3);
// → false

map.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// → true

map.hasValue(x, 3, null, v => Math.abs(v));
// → true


References

Clone this wiki locally