diff --git a/diff.js b/diff.js index 8c42dad..67015d0 100644 --- a/diff.js +++ b/diff.js @@ -54,6 +54,7 @@ var DIFF_TYPES = new Set([ // zip(func, array, array, ...) // -> [func(i, [item, item, ...]), ...] // +// XXX revise... var zip = function(func, ...arrays){ var i = arrays[0] instanceof Array ? 0 : arrays.shift() if(func instanceof Array){ @@ -79,8 +80,9 @@ var zip = function(func, ...arrays){ // done... : [] } + // XXX should we handle properties??? -// XXX use zip(..)... +// XXX use zip(..)??? var _diff_items = function(diff, res, A, B, options, filter){ // JSON mode -> ignore attr order... var kA = Object.keys(A) @@ -152,6 +154,8 @@ var _diff_item_order = function(diff, res, A, B, options, filter){ // get common chuncs (LCS)... +// XXX handle sparse arrays correctly... +// ...now empty slots get filled with undefined... var getCommonSections = function(A, B, cmp, min_chunk){ cmp = cmp || function(a, b){ return a === b || a == b } @@ -230,6 +234,9 @@ var getCommonSections = function(A, B, cmp, min_chunk){ // ], // ... // ] +// +// XXX handle sparse arrays correctly... +// ...now empty slots get filled with undefined... var getDiffSections = function(A, B, cmp, min_chunk){ // find the common sections... var common_sections = getCommonSections(A, B, cmp, min_chunk) @@ -352,6 +359,8 @@ function(A, B, options, cache){ || (diff(a, b) == null) } // Array... + // XXX handle sparse arrays correctly... + // ...now empty slots get filled with undefined... // XXX check seen -- avoid recursion... if(A instanceof Array && B instanceof Array){ var res = {