2.2.5 • Published 3 years ago
@extra-object/has-value v2.2.5
Checks if object has a value. :running: :package: :ledger:
Alternatives: has, hasValue, hasEntry, hasSubset, hasPath. Similar: value, values, hasValue. This is part of package extra-object.
object.hasValue(x, v, [fc], [fm]);
// x: an object
// v: 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