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