Fixed model property declaration issue with excess commas. #288

Merged
merged 1 commit into from Dec 21, 2012
Jump to file or symbol
Failed to load files and symbols.
+34 −18
Diff settings

Always

Just for now

@@ -1,15 +1,23 @@
var <%= names.constructor.singular %> = function () {
+<%
+var propertyOutput = [],
+ currentProperty;
+for (var i in properties) {
+ if (properties[i].name && properties[i].name !== "id") {
+ currentProperty = properties[i].name + ": {type: '" + properties[i].type + "'";
+
+ if (i === "default") {
+ currentProperty += ", required: true";
+ }
+
+ currentProperty += "}";
+ propertyOutput.push(currentProperty);
+ }
+}
+%>
this.defineProperties({
-<% for (var i in properties) { -%>
-<% if (properties[i].name && properties[i].name !== 'id') { -%>
-<% if (i === 'default') { -%>
- <%= properties[i].name %>: {type: '<%= properties[i].type %>', required: true},
-<% } else { -%>
- <%= properties[i].name %>: {type: '<%= properties[i].type %>'},
-<% } -%>
-<% } -%>
-<% } -%>
+ <%- propertyOutput.join(",\n "); %>
});
<% for(var i in properties) { -%>
@@ -1,15 +1,23 @@
var <%= names.constructor.singular %> = function () {
+<%
+var propertyOutput = [],
+ currentProperty;
+for (var i in properties) {
+ if (properties[i].name && properties[i].name !== "id") {
+ currentProperty = properties[i].name + ": {type: '" + properties[i].type + "'";
+
+ if (i === "default") {
+ currentProperty += ", required: true";
+ }
+
+ currentProperty += "}";
+ propertyOutput.push(currentProperty);
+ }
+}
+%>
this.defineProperties({
-<% for (var i in properties) { -%>
-<% if (properties[i].name && properties[i].name !== 'id') { -%>
-<% if (i === 'default') { -%>
- <%= properties[i].name %>: {type: '<%= properties[i].type %>', required: true},
-<% } else { -%>
- <%= properties[i].name %>: {type: '<%= properties[i].type %>'},
-<% } -%>
-<% } -%>
-<% } -%>
+ <%- propertyOutput.join(",\n "); %>
});
<% for(var i in properties) { -%>