mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-28 18:40:09 +00:00
notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b6f7bc369d
commit
d83a83b693
11
diff.js
11
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 = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user