flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

question about the diff result structure #119

Closed wqftowan closed 6 years ago

wqftowan commented 6 years ago

Hey @flitbit ,

I have one question about the diff result structure about kind of 'A' for V0.3.8. For instance, giving var lhs = {a: []}; var rhs = {a: [1]}; The diff result is with kind == 'A', index == 0, path == ["a"] and item == {kind: "N", rhs: 1}. I've no idea why it does not give the result with kind == 'N', path == ["a", 0], and rhs == 1? In this way there should be no need to maintain the 'A' kind for diff result, IMO it's much easier to be understood. Thanks.

wqftowan commented 6 years ago

a

flitbit commented 6 years ago

Ever since this became a top 1% NPM component I've tried to refrain from changing the structure of the diff result in order to not break the many many users of the library. You'll see I only changed it once.

Your suggestion seems logical.