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

Commit 3181396f by Sascha Depold

check if object has own property in "var in" loop

1 parent 0d639ca8
Showing with 4 additions and 0 deletions
......@@ -15,6 +15,7 @@ module.exports = (function() {
, attrStr = []
for (var attr in attributes) {
if (attributes.hasOwnProperty(attr)) {
var dataType = attributes[attr]
if (Utils._.includes(dataType, 'PRIMARY KEY')) {
......@@ -24,6 +25,7 @@ module.exports = (function() {
attrStr.push(Utils.addTicks(attr) + " " + dataType)
}
}
}
var values = {
table: Utils.addTicks(tableName),
......@@ -380,12 +382,14 @@ module.exports = (function() {
var fields = []
for (var name in factory.attributes) {
if (factory.attributes.hasOwnProperty(name)) {
var definition = factory.attributes[name]
if (definition && (definition.indexOf('auto_increment') > -1)) {
fields.push(name)
}
}
}
return fields
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!