Returns true if a contains the values of b. a may contain other values, but we only check against what is in b. a and b must both be simple objects.
a
b
const obj = { name: `Elle`, size: 100, colour: { red: 0.5, green: 0.1, blue: 0.2 }}isEqualValuePartial(obj, { name: `Elle` }); // trueisEqualValuePartial(obj, { name: { colour: red: { 0.5, green: 0.1 }} }); // trueisEqualValuePartial(obj, { name: `Ellen` }); // falseisEqualValuePartial(obj, { lastname: `Elle` }); // false Copy
const obj = { name: `Elle`, size: 100, colour: { red: 0.5, green: 0.1, blue: 0.2 }}isEqualValuePartial(obj, { name: `Elle` }); // trueisEqualValuePartial(obj, { name: { colour: red: { 0.5, green: 0.1 }} }); // trueisEqualValuePartial(obj, { name: `Ellen` }); // falseisEqualValuePartial(obj, { lastname: `Elle` }); // false
Optional
Returns true if
a
contains the values ofb
.a
may contain other values, but we only check against what is inb
.a
andb
must both be simple objects.