https://www.npmjs.com/package/shallowequal

    1. function shallowEqual(x, y) {
    2. if (x === y) return true;
    3. if (typeof x == "object" && x != null && typeof y == "object" && y != null) {
    4. if (Object.keys(x).length != Object.keys(y).length) return false;
    5. for (var prop in x) {
    6. if (y.hasOwnProperty(prop)) {
    7. if (x[prop] !== y[prop]) return false;
    8. }
    9. return false;
    10. }
    11. return true;
    12. }
    13. return false;
    14. }