never ever ever!!! lean on type juggling. laziness has a price...

This commit is contained in:
Chris Kruining 2025-01-27 15:40:16 +01:00
parent f86f2a698f
commit 8ac4b0df3a
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2

View file

@ -68,13 +68,13 @@ export function* deepDiff<T1 extends object, T2 extends object>(a: T1, b: T2, pa
} }
for (const [[keyA, valueA], [keyB, valueB]] of zip(entriesOf(a), entriesOf(b))) { for (const [[keyA, valueA], [keyB, valueB]] of zip(entriesOf(a), entriesOf(b))) {
if (keyA === undefined && keyB) { if (keyA === undefined && keyB !== undefined) {
yield { key: path.concat(keyB.toString()).join('.'), kind: MutarionKind.Create, value: valueB }; yield { key: path.concat(keyB.toString()).join('.'), kind: MutarionKind.Create, value: valueB };
continue; continue;
} }
if (keyA && keyB === undefined) { if (keyA !== undefined && keyB === undefined) {
yield { key: path.concat(keyA.toString()).join('.'), kind: MutarionKind.Delete, original: valueA }; yield { key: path.concat(keyA.toString()).join('.'), kind: MutarionKind.Delete, original: valueA };
continue; continue;