hasValue - nodef/extra-iterable GitHub Wiki

Check if iterable has a value.

Alternatives: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPath. Similar: values, hasValue, searchValue.

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

var x = [1, 2, -3];
xiterable.hasValue(x, 3);
// → false

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

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