hasValue - nodef/extra-lists GitHub Wiki

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](/nodef/extra-lists/wiki/'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

References