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

Commit 2a25f661 by Jan Aagaard Meier

Added curlies in DAO to make jshint happy :)

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