slate 0.126.1 → 0.126.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1099,42 +1099,37 @@ var Operation = {
1099
1099
 
1100
1100
  var isObject = value => typeof value === 'object' && value !== null;
1101
1101
 
1102
- /*
1103
- Custom deep equal comparison for Slate nodes.
1104
-
1105
- We don't need general purpose deep equality;
1106
- Slate only supports plain values, Arrays, and nested objects.
1107
- Complex values nested inside Arrays are not supported.
1108
-
1109
- Slate objects are designed to be serialised, so
1110
- missing keys are deliberately normalised to undefined.
1102
+ /**
1103
+ * Custom deep equal comparison for Slate nodes. Since Slate only supports plain
1104
+ * values, arrays and nested objects, we don't need a general purpose deep
1105
+ * equality check.
1106
+ *
1107
+ * Slate objects are designed to be serialised, so missing keys are deliberately
1108
+ * normalised to undefined.
1111
1109
  */
1112
- var isDeepEqual = (node, another) => {
1113
- for (var key in node) {
1114
- var a = Object.hasOwn(node, key) ? node[key] : undefined;
1115
- var b = Object.hasOwn(another, key) ? another[key] : undefined;
1116
- if (Array.isArray(a) && Array.isArray(b)) {
1117
- if (a.length !== b.length) return false;
1118
- for (var i = 0; i < a.length; i++) {
1119
- if (a[i] !== b[i]) return false;
1120
- }
1121
- } else if (isObject(a) && isObject(b)) {
1122
- if (!isDeepEqual(a, b)) return false;
1123
- } else if (a !== b) {
1124
- return false;
1110
+ var isDeepEqual = (a, b) => {
1111
+ if (Array.isArray(a) && Array.isArray(b)) {
1112
+ if (a.length !== b.length) return false;
1113
+ for (var i = 0; i < a.length; i++) {
1114
+ if (!isDeepEqual(a[i], b[i])) return false;
1125
1115
  }
1116
+ return true;
1126
1117
  }
1127
- /*
1128
- Deep object equality is only necessary in one direction; in the reverse direction
1129
- we are only looking for keys that are missing.
1130
- As above, undefined keys are normalised to missing.
1131
- */
1132
- for (var _key in another) {
1133
- if (node[_key] === undefined && another[_key] !== undefined) {
1134
- return false;
1118
+ if (isObject(a) && isObject(b)) {
1119
+ for (var key in a) {
1120
+ var valueA = Object.hasOwn(a, key) ? a[key] : undefined;
1121
+ var valueB = Object.hasOwn(b, key) ? b[key] : undefined;
1122
+ if (!isDeepEqual(valueA, valueB)) return false;
1123
+ }
1124
+ // Deep object equality is only necessary in one direction; in the reverse
1125
+ // direction we are only looking for keys that are missing. As above,
1126
+ // undefined keys treated the same as missing keys.
1127
+ for (var _key in b) {
1128
+ if (a[_key] === undefined && b[_key] !== undefined) return false;
1135
1129
  }
1130
+ return true;
1136
1131
  }
1137
- return true;
1132
+ return a === b;
1138
1133
  };
1139
1134
 
1140
1135
  /**