Function compareKeys

Compares the keys of two objects, returning a set of those in common, and those in either A or B exclusively.

const a = { colour: `red`, intensity: 5 };
const b = { colour: `pink`, size: 10 };
const c = compareKeys(a, b);
// c.shared = [ `colour` ]
// c.a = [ `intensity` ]
// c.b = [ `size` ]
  • Parameters

    • a: object
    • b: object

    Returns {
        a: string[];
        b: string[];
        isSame: boolean;
        shared: string[];
    }

    • a: string[]
    • b: string[]
    • isSame: boolean
    • shared: string[]