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

Commit bf30982c by Mick Hansen

eliminate another loop

1 parent 6c9a76dc
Showing with 9 additions and 4 deletions
...@@ -679,6 +679,12 @@ module.exports = (function() { ...@@ -679,6 +679,12 @@ module.exports = (function() {
} }
DAOFactory.prototype.bulkBuild = function(valueSets, options) { DAOFactory.prototype.bulkBuild = function(valueSets, options) {
options = options || { isNewRecord: true, isDirty: true }
if (options.hasOwnProperty('include') && options.include && !options.includeValidated) {
validateIncludedElements.call(this, options)
}
return valueSets.map(function (values) { return valueSets.map(function (values) {
return this.build(values, options) return this.build(values, options)
}.bind(this)) }.bind(this))
...@@ -1408,6 +1414,7 @@ module.exports = (function() { ...@@ -1408,6 +1414,7 @@ module.exports = (function() {
include.hasParentRequired = options.hasParentRequired || !!options.required include.hasParentRequired = options.hasParentRequired || !!options.required
options.includeMap[include.as] = include options.includeMap[include.as] = include
options.includeMap[include.as.substr(0,1).toLowerCase() + include.as.substr(1)] = include
options.includeNames.push(include.as) options.includeNames.push(include.as)
options.includeNames.push(include.as.substr(0,1).toLowerCase() + include.as.substr(1)) options.includeNames.push(include.as.substr(0,1).toLowerCase() + include.as.substr(1))
......
...@@ -215,10 +215,8 @@ module.exports = (function() { ...@@ -215,10 +215,8 @@ module.exports = (function() {
}) })
} }
var include = _.find(this.options.include, function (include) { var include = this.options.includeMap[key]
return include.as === key || (include.as.slice(0,1).toLowerCase() + include.as.slice(1)) === key , association = include.association
})
var association = include.association
, self = this , self = this
, accessor = Utils._.camelize(key) , accessor = Utils._.camelize(key)
, childOptions , childOptions
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!