Use custom object formatters for any part of a diff, not just leaf nodes

This commit is contained in:
Steve Gravrock
2020-02-01 18:49:06 -08:00
committed by Steve Gravrock
parent 25816a6e77
commit 873d1c2945
15 changed files with 669 additions and 141 deletions

View File

@@ -11,10 +11,24 @@ getJasmineRequireObj().ObjectPath = function(j$) {
}
};
ObjectPath.prototype.dereference = function(obj) {
var i;
for (i = 0; i < this.components.length; i++) {
obj = obj[this.components[i]];
}
return obj;
};
ObjectPath.prototype.add = function(component) {
return new ObjectPath(this.components.concat([component]));
};
ObjectPath.prototype.shift = function() {
return new ObjectPath(this.components.slice(1));
};
ObjectPath.prototype.depth = function() {
return this.components.length;
};