Skip to content

hasValue

Subhajit Sahu edited this page Feb 4, 2021 · 11 revisions

Checks if map has a value. 🏃 📼 📦 🌔 📒

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
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.hasValue(x, 3);
// false

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

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

references

Clone this wiki locally