flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
3k stars 214 forks source link

Ignore certain kinds of kind #105

Open elmarti opened 7 years ago

elmarti commented 7 years ago

I'm trying to only list structural differences, so I'm not interested in the text content. Is there a more efficient way of filtering them out than the following? (I know forEach isn't the most efficient)

var data1= require("./data1.json);
var data2= require("./data2.json");
var diff = require("deep-diff").diff;

var differences = diff(data1, data2);
differences.forEach(function(thisDiff){
   if(thisDiff.kind !== "E")
       console.log(thisDiff);
});