@angular-jz/jz
Version:
jim jz
32 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var ObjectUtility = /** @class */ (function () {
function ObjectUtility() {
}
///判断两个对象的内容是否相等
ObjectUtility.eq = function (a, b) {
// Of course, we can do it use for in
// Create arrays of property names
var aProps = Object.getOwnPropertyNames(a);
var bProps = Object.getOwnPropertyNames(b);
// If number of properties is different,
// objects are not equivalent
if (aProps.length != bProps.length) {
return false;
}
for (var i = 0; i < aProps.length; i++) {
var propName = aProps[i];
// If values of same property are not equal,
// objects are not equivalent
if (a[propName] !== b[propName]) {
return false;
}
}
// If we made it this far, objects
// are considered equivalent
return true;
};
return ObjectUtility;
}());
exports.ObjectUtility = ObjectUtility;
//# sourceMappingURL=object-utility.js.map