function objectShallowEquals(a, b) {
    const entriesInA = Object.entries(Object(a));

    if (entriesInA.length !== Object.keys(b).length) {
        return false;
    }

    return entriesInA.every(
        ([key, value]) => b.hasOwnProperty(key) && b[key] === value
    );
}
Fastest way to check if two objects are equal.
Object and array values have to be referentially equal.