2.2.15 • Published 4 years ago
@extra-map/has-value.min v2.2.15
Checks if map has a value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath. Similar: value, values, hasValue.
This is part of package extra-map.
This is browserified, minified version of @extra-map/has-value. It is exported as global variable map_hasValue. CDN: unpkg, jsDelivr.
map.hasValue(x, v, [fc], [fm]);
// x: a map
// v: value?
// fc: compare function (a, b)
// fm: map function (v, k, x)
const map = require("extra-map");
var x = new Map([["a", 1], ["b", 2], ["c", -3]]);
map.hasValue(x, 3);
// false
map.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// true
map.hasValue(x, 3, null, v => Math.abs(v));
// true