-
Notifications
You must be signed in to change notification settings - Fork 1
hasValue
Subhajit Sahu edited this page Jun 28, 2020
·
11 revisions
Checks if iterable has a value. 🏃 📼 📦 🌔 📒
Similar: values, hasValue, searchValue.
Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence.
iterable.hasValue(x, v, [fc], [fm]);
// x: an iterable
// v: value?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const iterable = require('extra-iterable');
var x = [1, 2, -3];
iterable.hasValue(x, 3);
// false
iterable.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// true
iterable.hasValue(x, 3, null, v => Math.abs(v));
// true