aboutsummaryrefslogtreecommitdiffstats
path: root/jsre
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-09 18:27:45 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-09 18:27:45 +0800
commit3f4ce70d9263ff635385d694b9ac3f3c5ad8de12 (patch)
tree099f39401ac290414fd2cdcf1a592c4b8841598e /jsre
parent11f65cf885317d6c355b4c4a8d7420bcb82839d1 (diff)
downloadgo-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar.gz
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar.bz2
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar.lz
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar.xz
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.tar.zst
go-tangerine-3f4ce70d9263ff635385d694b9ac3f3c5ad8de12.zip
jsre: fix wrong separator comma placing due to non consistent field orders
Diffstat (limited to 'jsre')
-rw-r--r--jsre/pp_js.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index 5c09b2586..4e0a04f83 100644
--- a/jsre/pp_js.go
+++ b/jsre/pp_js.go
@@ -26,19 +26,19 @@ function pp(object, indent) {
} else if(typeof(object) === "object") {
str += "{\n";
indent += " ";
- var last = getFields(object).pop()
- getFields(object).forEach(function (k) {
- str += indent + k + ": ";
+
+ var fields = getFields(object);
+ var last = fields[fields.length - 1];
+ fields.forEach(function (key) {
+ str += indent + key + ": ";
try {
- str += pp(object[k], indent);
+ str += pp(object[key], indent);
} catch (e) {
str += pp(e, indent);
}
-
- if(k !== last) {
+ if(key !== last) {
str += ",";
}
-
str += "\n";
});
str += indent.substr(2, indent.length) + "}";