hasValue - nodef/extra-entries GitHub Wiki

Check if entries has a value.

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

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

var x = ["a", 1], ["b", 2], ["c", -3](/nodef/extra-entries/wiki/"a",-1],-["b",-2],-["c",--3);
entries.hasValue(x, 3);
// → false

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

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

References