Skip to content

hasValue

Subhajit Sahu edited this page Jun 28, 2020 · 11 revisions

Checks if iterable has a value. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]

Similar: [values], [hasValue], [searchValue].
Similar: [hasValue], [hasPrefix], [hasInfix], [hasSuffix], [hasSubsequence].

iterable.isValue(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
Clone this wiki locally