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

Commit 938aaf50 by Mick Hansen

Merge pull request #3939 from MrVoltz/patch-1

.equals() should compare dataValues directly
2 parents 39e0ce5a 48f41f29
Showing with 7 additions and 3 deletions
...@@ -993,12 +993,16 @@ Instance.prototype.decrement = function(fields, options) { ...@@ -993,12 +993,16 @@ Instance.prototype.decrement = function(fields, options) {
*/ */
Instance.prototype.equals = function(other) { Instance.prototype.equals = function(other) {
var result = true; var result = true;
if (!other || !other.dataValues) {
return false;
}
Utils._.each(this.dataValues, function(value, key) { Utils._.each(this.dataValues, function(value, key) {
if (Utils._.isDate(value) && Utils._.isDate(other[key])) { if (Utils._.isDate(value) && Utils._.isDate(other.dataValues[key])) {
result = result && (value.getTime() === other[key].getTime()); result = result && (value.getTime() === other.dataValues[key].getTime());
} else { } 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!