hasValue - nodef/extra-object GitHub Wiki

Check if object has a value.

Similar: has, hasValue, hasEntry, hasSubset, hasPath. Similar: keys, values, entries.

function hasValue(x, v, fc, fm)
// x:  an object
// v:  search value
// fc: compare function (a, b)
// fm: map function (v, k, x)
const object = require('extra-object');

var x = {a: 1, b: 2, c: -3};
object.hasValue(x, 3);
// → false

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

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

References