function isEqual()

in src/utils/json-patch.js [273:293]


  function isEqual(a, b) {
    const typeA = typeof a;
    const typeB = typeof b;
    if (typeA !== typeB) {
      return false;
    }

    switch (typeA) {
    case OBJECT: {
      // recursively compare children of objects and arrays to deeply check that
      // all values are equal
      const aKeys = Object.keys(a);
      const bKeys = Object.keys(b);
      return aKeys.length === bKeys.length && aKeys.every((key, i) => (
        key === bKeys[i] && isEqual(a[key], b[key])
      ));
    }
    default:
      return a === b;
    }
  }