-
Notifications
You must be signed in to change notification settings - Fork 0
hasValue
Subhajit Sahu edited this page Dec 28, 2022
·
10 revisions
Check if lists has a value.
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: randomValue, values, hasValue.
function hasValue(x, v, fc, fm)
// x: lists
// v: search value
// fc: compare function (a, b)
// fm: map function (v, k, x)
const xlists = require('extra-lists');
var x = [['a', 'b', 'c'], [1, 2, -3]];
xlists.hasValue(x, 3);
// → false
xlists.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// → true
xlists.hasValue(x, 3, null, v => Math.abs(v));
// → true