Function isEqualValuePartial

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.

const obj = {
name: `Elle`,
size: 100,
colour: {
red: 0.5,
green: 0.1,
blue: 0.2
}
}

isEqualValuePartial(obj, { name: `Elle` }); // true
isEqualValuePartial(obj, { name: { colour: red: { 0.5, green: 0.1 }} }); // true

isEqualValuePartial(obj, { name: `Ellen` }); // false
isEqualValuePartial(obj, { lastname: `Elle` }); // false
  • Type Parameters

    • T1 extends Record<string, any>
    • T2 extends Record<string, any>

    Parameters

    Returns boolean