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

Commit 2a25f661 by Jan Aagaard Meier

Added curlies in DAO to make jshint happy :)

1 parent 22f872f4
Showing with 14 additions and 8 deletions
......@@ -256,7 +256,9 @@ module.exports = (function() {
var identifier = this.__options.hasPrimaryKeys ? this.primaryKeyValues : { id: this.id },
values = {}
if (count === undefined) count = 1;
if (count === undefined) {
count = 1;
}
if (Utils._.isString(fields)) {
values[fields] = count;
......@@ -305,17 +307,20 @@ module.exports = (function() {
}
DAO.prototype.addAttribute = function(attribute, value) {
if (typeof this.dataValues[attribute] !== 'undefined')
return;
if (typeof this.dataValues[attribute] !== 'undefined') {
return
}
if (this.booleanValues.length && this.booleanValues.indexOf(attribute) !== -1 && value !== undefined) // transform integer 0,1 into boolean
value = !!value;
if (this.booleanValues.length && this.booleanValues.indexOf(attribute) !== -1 && value !== undefined) { // transform integer 0,1 into boolean
value = !!value
}
var has = (function(o) {
var predef = Object.getOwnPropertyDescriptor(o, attribute);
if (predef && predef.hasOwnProperty('value'))
return true; // true here means 'this property exist as a simple value property, do not place setters or getters at all'
if (predef && predef.hasOwnProperty('value')) {
return true // true here means 'this property exist as a simple value property, do not place setters or getters at all'
}
return {
get: (predef && predef.hasOwnProperty('get') ? predef.get : null) || o.__lookupGetter__(attribute),
......@@ -368,8 +373,9 @@ module.exports = (function() {
if (isNewRecord) {
if (this.hasDefaultValues) {
Utils._.each(this.defaultValues, function(valueFn, key) {
if (!defaults.hasOwnProperty(key))
if (!defaults.hasOwnProperty(key)) {
defaults[key] = valueFn()
}
})
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!