-
Notifications
You must be signed in to change notification settings - Fork 1
hasValue
Subhajit Sahu edited this page Feb 3, 2021
·
11 revisions
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