So I have two JSON objects and I am trying to find difference between them using underscore js. However for some reason its returning me the whole object instead of just returning the difference. My goal here is to get the pattern back as its the only thing different.
var a = {
"name":"donor",
"label":"Donor Data File (donor)",
"pattern":"^donor(\\.[a-zA-Z0-9]+)?\\.txt(?:\\.gz|\\.bz2)?$"
};
var b = {
"name":"donor",
"label":"Donor Data File (donor)",
"pattern":"^donor(\\.[a-zA-Z0-9]+)?\\.txt(?:\\.gz)?$"
};
console.log(_.difference(a,b));
Am I not understanding the use case of _.difference
properly? Heres a JSFiddle in case needed.