+0
-37
@@ -1,6 +0,1 @@ | ||
| var jsonData = ""; | ||
| // console mode only: | ||
| if (!module.parent) { var stdin = process.openStdin(); } | ||
| var clean = function(jsonInput, callback) { | ||
@@ -27,35 +22,3 @@ | ||
| if (!module.parent) { // in console mode only | ||
| stdin.on('data', function(chunk) { | ||
| jsonData += chunk; | ||
| }); | ||
| stdin.on('end', function() { | ||
| clean(jsonData, function(err, cleanJSON) { | ||
| if (err) { | ||
| process.stdout.write ("ERROR: Malformed JSON Document provided as input. Exiting.\n"); | ||
| process.exit(1); | ||
| } | ||
| process.stdout.write(cleanJSON); | ||
| process.stdout.write("\n"); | ||
| process.exit(0); | ||
| }); | ||
| }); | ||
| } | ||
| // Exports | ||
| module.exports.clean = clean; | ||
| module.exports.init = function() { | ||
| if (!module.parent) { | ||
| stdin.setEncoding("utf8"); | ||
| stdin.resume(); | ||
| } | ||
| } | ||
+1
-1
| { | ||
| "name": "cleanjson" | ||
| , "description": "Format JSON document from stdin as 'comma-first' JSON" | ||
| , "version": "0.1.1" | ||
| , "version": "0.1.2" | ||
| , "repository": { | ||
@@ -6,0 +6,0 @@ "type": "git" |
Sorry, the diff of this file is not supported yet
3335
-6.08%17
-59.52%