diff --git a/lib/discrepances.js b/lib/discrepances.js index b664da8..dfb1214 100644 --- a/lib/discrepances.js +++ b/lib/discrepances.js @@ -38,6 +38,12 @@ function getClass(variable) { if(variable instanceof Object) { return 'Object'; } throw new Error('undetected class type'); } + +function compare(result, a, b, index) { + var diff = discrepances(a[index], b[index]); + result.push(diff || null); +} + discrepances = function discrepances(a, b){ if(a === b){ return null; @@ -49,8 +55,25 @@ discrepances = function discrepances(a, b){ if(typeA==='object' || typeB==='object') { var classA = getClass(a); var classB = getClass(b); + //console.log("classA", classA, "classB", classB) if(classA !== classB) { return {classes:[classA,classB], values:[a,b]}; + } else { + if(classA==='Array') { + var res=[]; + var max = Math.min(a.length, b.length); + for(var i_ab=0; i_ab