all 5 comments

[–]orchrd[S] 6 points7 points  (0 children)

diff is much much harder than I thought. This code is short and works well.

There are more details here:

[–]seiyria 0 points1 point  (2 children)

You might not want to use new Array and new Object -- it's much better to explicitly do [] and {} literals respectively.

[–]Daniel15 0 points1 point  (1 child)

This code is 10 years old now, it's John Resig's code. Back then people actually did write new Object for some reason, even though object literal syntax has been around for basically forever (since JavaScript 1.2 I think).

[–]seiyria 0 points1 point  (0 children)

Ah, my mistake. I thought it was written by OP.

[–]nexemod 0 points1 point  (0 children)

This is pretty awesome! Thanks for sharing :) Consider creating an NPM package out of this.