@aspruyt/xfg 3.10.1 → 3.10.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.
|
@@ -163,15 +163,27 @@ function matchByType(current, desired) {
|
|
|
163
163
|
currentByType.set(type, item);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
const desiredTypes = new Set();
|
|
166
167
|
const result = [];
|
|
167
168
|
for (const desiredItem of desired) {
|
|
168
169
|
const type = desiredItem.type;
|
|
170
|
+
desiredTypes.add(type);
|
|
169
171
|
const currentItem = currentByType.get(type);
|
|
170
172
|
if (currentItem) {
|
|
171
173
|
result.push(projectToDesiredShape(currentItem, desiredItem));
|
|
172
174
|
}
|
|
173
175
|
// If no match in current, skip — diff handles additions
|
|
174
176
|
}
|
|
177
|
+
// Append current items not in desired — these are removals that
|
|
178
|
+
// deepEqual must detect (length mismatch). Fixes #549.
|
|
179
|
+
for (const item of current) {
|
|
180
|
+
if (isPlainObject(item)) {
|
|
181
|
+
const type = item.type;
|
|
182
|
+
if (type && !desiredTypes.has(type)) {
|
|
183
|
+
result.push(item);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
175
187
|
return result;
|
|
176
188
|
}
|
|
177
189
|
function matchByIndex(current, desired) {
|
package/package.json
CHANGED