jsondiffpatch icon indicating copy to clipboard operation
jsondiffpatch copied to clipboard

Incorrect Comment?

Open ccorcos opened this issue 5 years ago • 1 comments

Reading through the code here and I think this comment is incorrect:

https://github.com/benjamine/jsondiffpatch/blob/ef38c5d97c349b0a3672c08710d1625307d3de94/src/filters/arrays.js#L338

We're performing inserts in order. And the logic is correct because that's the only way we can build up a really long array.

Just thought I'd let you know. And nice job -- your code is pretty clean!

ccorcos avatar Jan 14 '20 20:01 ccorcos

hi @ccorcos , sorry for the delay, and thanks for the comment! I read it again and I think you're right!, probably my mistake copying the comment from the removals a bit above, but inserts make sense to make them in incremental index order, as those indices in the delta are already expressed as in the final (right) array.

benjamine avatar Jan 20 '20 19:01 benjamine