Skip to content

Commit

Permalink
Other: Various other minor improvements / assertions refactored away,…
Browse files Browse the repository at this point in the history
… see #653
  • Loading branch information
dcodeIO committed Jan 24, 2017
1 parent 735da43 commit dd96dcd
Show file tree
Hide file tree
Showing 39 changed files with 390 additions and 672 deletions.
10 changes: 4 additions & 6 deletions cli/targets/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ function static_target(root, options, callback) {
else
push("// Exported root namespace");
}
var rootName = config.root || "default";
push("var $root = $protobuf.roots[" + JSON.stringify(rootName) + "] || ($protobuf.roots[" + JSON.stringify(rootName) + "] = {});");
var rootProp = cliUtil.safeProp(config.root || "default");
push("var $root = $protobuf.roots" + rootProp + " || ($protobuf.roots" + rootProp + " = {});");
buildNamespace(null, root);
push("");
if (config.comments)
Expand Down Expand Up @@ -274,15 +274,13 @@ function buildType(ref, type) {
]);
push("function " + name(type.name) + "(properties) {");
++indent;
push("if (properties) {");
push("if (properties)");
++indent;
push("var keys = Object.keys(properties);");
push("for (var i = 0; i < keys.length; ++i)");
push("for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)");
++indent;
push("this[keys[i]] = properties[keys[i]];");
--indent;
--indent;
push("}");
--indent;
push("}");

Expand Down
Loading

0 comments on commit dd96dcd

Please sign in to comment.