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

Commit a7946541 by overlookmotel

var declarations moved out of loop

1 parent 5a44304b
Showing with 6 additions and 4 deletions
...@@ -536,14 +536,17 @@ module.exports = (function() { ...@@ -536,14 +536,17 @@ module.exports = (function() {
// (checking associations to see if names should be singularised or not) // (checking associations to see if names should be singularised or not)
var tableNames = [] var tableNames = []
, parentAssociation , parentAssociation
, len = obj.length; , len = obj.length
, item
, model
, as
, association;
for (var i = 0; i < len - 1; i++) { for (var i = 0; i < len - 1; i++) {
var item = obj[i]; item = obj[i];
if (item._modelAttribute || Utils._.isString(item) || item._isSequelizeMethod || 'raw' in item) { if (item._modelAttribute || Utils._.isString(item) || item._isSequelizeMethod || 'raw' in item) {
break; break;
} }
var model, as;
if (item instanceof Model) { if (item instanceof Model) {
model = item; model = item;
as = undefined; as = undefined;
...@@ -553,7 +556,6 @@ module.exports = (function() { ...@@ -553,7 +556,6 @@ module.exports = (function() {
} }
// check if model provided is through table // check if model provided is through table
var association;
if (!as && parentAssociation && parentAssociation.through.model === model) { if (!as && parentAssociation && parentAssociation.through.model === model) {
association = {as: Utils.singularize(model.tableName, model.options.language)}; association = {as: Utils.singularize(model.tableName, model.options.language)};
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!