Skip to content

Commit 3f4ce70

Browse files
committed
jsre: fix wrong separator comma placing due to non consistent field orders
1 parent 11f65cf commit 3f4ce70

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

jsre/pp_js.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ function pp(object, indent) {
2626
} else if(typeof(object) === "object") {
2727
str += "{\n";
2828
indent += " ";
29-
var last = getFields(object).pop()
30-
getFields(object).forEach(function (k) {
31-
str += indent + k + ": ";
29+
30+
var fields = getFields(object);
31+
var last = fields[fields.length - 1];
32+
fields.forEach(function (key) {
33+
str += indent + key + ": ";
3234
try {
33-
str += pp(object[k], indent);
35+
str += pp(object[key], indent);
3436
} catch (e) {
3537
str += pp(e, indent);
3638
}
37-
38-
if(k !== last) {
39+
if(key !== last) {
3940
str += ",";
4041
}
41-
4242
str += "\n";
4343
});
4444
str += indent.substr(2, indent.length) + "}";

0 commit comments

Comments
 (0)