-
Notifications
You must be signed in to change notification settings - Fork 0
hasValue
Subhajit Sahu edited this page Dec 22, 2022
·
11 revisions
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]];
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