不要怂,就是干,撸起袖子干!

Commit 46b58d76 by MrVoltz

.equals() should compare dataValues directly

Avoids changes created by other's getters
1 parent bebad6e2
Showing with 6 additions and 3 deletions
......@@ -994,11 +994,14 @@ Instance.prototype.decrement = function(fields, options) {
Instance.prototype.equals = function(other) {
var result = true;
if(!other || !other.dataValues)
return false;
Utils._.each(this.dataValues, function(value, key) {
if (Utils._.isDate(value) && Utils._.isDate(other[key])) {
result = result && (value.getTime() === other[key].getTime());
if (Utils._.isDate(value) && Utils._.isDate(other.dataValues[key])) {
result = result && (value.getTime() === other.dataValues[key].getTime());
} else {
result = result && (value === other[key]);
result = result && (value === other.dataValues[key]);
}
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!