Detect renamed keys
I'd like to have a small diff for when keys change.
I set objectHash: JSON.stringify. Is there another option to detect when only the key is renamed?
objectHash is only used among items on the same array, not with objects.
that type of change seem hard to detect in a generic way, especially when changes are nested,
in the example it seems trivial, but how much similarity between 2 branches of the graph would indicate the keys swapped?
to detect key changes, I'd recommend to convert encoding to an array, (and have key be another property of the array items) if that's possible (using the objectHash you mention).
you can always convert to object map afterwards.
otherwise it's always possible to write a jsondiffpatch plugin that adds new type of diffs, but that's not going to be trivial.
Are you suggestions an objectHash method that ignores the key property? That's a great idea. How do I convert the data back to an object map afterwards and make sure the diff visualization still works?
correct, but you got me there, the visualization wouldn't show it as an object if you convert to array to generate the diff, I guess I was assuming, that while not ideal, the visual representation is still OK as an array to represent this in your case.