aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 08f93a05..7c5c5f4f 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -220,7 +220,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
funcs.push(x + ': ' + snippet[x].toString());
}
}
- snippet = JSON.stringify(snippet).replace(/}$/, ', ' + funcs.join(', ') + ' }');
+ snippet = JSON.stringify(snippet);
+ if (funcs.length > 0) {
+ snippet = snippet.replace(/}$/, ', ' + funcs.join(', ') + ' }');
+ }
} else if (typeof snippet === 'function') {
snippet = snippet.toString();
if (/function ?\(/.exec(snippet)) { // name the function, if not already named