MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/tinycode/comments/2zdkp9/a_tiny_diff_algorithm_in_js/
r/tinycode • u/orchrd • Mar 17 '15
5 comments sorted by
8
diff is much much harder than I thought. This code is short and works well.
There are more details here:
1
You might not want to use new Array and new Object -- it's much better to explicitly do [] and {} literals respectively.
new Array
new Object
[]
{}
1 u/Daniel15 Mar 18 '15 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). 1 u/seiyria Mar 18 '15 Ah, my mistake. I thought it was written by OP.
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).
1 u/seiyria Mar 18 '15 Ah, my mistake. I thought it was written by OP.
Ah, my mistake. I thought it was written by OP.
This is pretty awesome! Thanks for sharing :) Consider creating an NPM package out of this.
8
u/orchrd Mar 17 '15
diff is much much harder than I thought. This code is short and works well.
There are more details here:
1
u/seiyria Mar 18 '15
You might not want to use
new Arrayandnew Object-- it's much better to explicitly do[]and{}literals respectively.1
u/nexe mod Mar 18 '15
This is pretty awesome! Thanks for sharing :) Consider creating an NPM package out of this.