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

Commit fb6a4451 by smihica

modified some needless "or".

1 parent 1eff0488
Showing with 7 additions and 7 deletions
...@@ -809,7 +809,7 @@ Instance.prototype.destroy = function(options) { ...@@ -809,7 +809,7 @@ Instance.prototype.destroy = function(options) {
options = Utils._.extend({ options = Utils._.extend({
hooks: true, hooks: true,
force: false force: false
}, options || {}); }, options);
return Promise.bind(this).then(function() { return Promise.bind(this).then(function() {
// Run before hook // Run before hook
...@@ -821,7 +821,7 @@ Instance.prototype.destroy = function(options) { ...@@ -821,7 +821,7 @@ Instance.prototype.destroy = function(options) {
if (this.Model._timestampAttributes.deletedAt && options.force === false) { if (this.Model._timestampAttributes.deletedAt && options.force === false) {
this.setDataValue(this.Model._timestampAttributes.deletedAt, new Date()); this.setDataValue(this.Model._timestampAttributes.deletedAt, new Date());
return this.save(_.extend(_.clone(options), {hooks : false})); return this.save(_.extend({}, options, {hooks : false}));
} else { } else {
where = {}; where = {};
var primaryKeys = this.Model.primaryKeyAttributes; var primaryKeys = this.Model.primaryKeyAttributes;
...@@ -855,7 +855,7 @@ Instance.prototype.restore = function(options) { ...@@ -855,7 +855,7 @@ Instance.prototype.restore = function(options) {
options = Utils._.extend({ options = Utils._.extend({
hooks: true, hooks: true,
force: false force: false
}, options || {}); }, options);
return Promise.bind(this).then(function() { return Promise.bind(this).then(function() {
// Run before hook // Run before hook
...@@ -864,7 +864,7 @@ Instance.prototype.restore = function(options) { ...@@ -864,7 +864,7 @@ Instance.prototype.restore = function(options) {
} }
}).then(function() { }).then(function() {
this.setDataValue(this.Model._timestampAttributes.deletedAt, null); this.setDataValue(this.Model._timestampAttributes.deletedAt, null);
return this.save(_.extend(_.clone(options), {hooks : false, omitNull : false})); return this.save(_.extend({}, options, {hooks : false, omitNull : false}));
}).tap(function() { }).tap(function() {
// Run after hook // Run after hook
if (options.hooks) { if (options.hooks) {
...@@ -913,13 +913,13 @@ Instance.prototype.increment = function(fields, options) { ...@@ -913,13 +913,13 @@ Instance.prototype.increment = function(fields, options) {
} }
} }
options = _.defaults({}, options || {}, { options = _.defaults({}, options, {
by: 1, by: 1,
attributes: {}, attributes: {},
where: {} where: {}
}); });
where = _.extend(options.where || {}, identifier); where = _.extend({}, options.where, identifier);
if (Utils._.isString(fields)) { if (Utils._.isString(fields)) {
values[fields] = options.by; values[fields] = options.by;
...@@ -970,7 +970,7 @@ Instance.prototype.increment = function(fields, options) { ...@@ -970,7 +970,7 @@ Instance.prototype.increment = function(fields, options) {
* @return {Promise} * @return {Promise}
*/ */
Instance.prototype.decrement = function(fields, options) { Instance.prototype.decrement = function(fields, options) {
options = _.defaults({}, options || {}, { options = _.defaults({}, options, {
by: 1 by: 1
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!