Skip to content

Commit

Permalink
add control to console logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jcramer committed Apr 8, 2019
1 parent 302d2ac commit 2dd4ddd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const spawn = require('child_process').spawn;
var getPath = function() {
return process.cwd() + '/node_modules/node-jq/bin/jq'
}
var run = function(filter, data) {
var run = function(filter, data, log_result=true) {
const child = spawn(getPath(), [filter]);
return new Promise(function(resolve, reject) {
let chunks = [];
Expand All @@ -11,7 +11,8 @@ var run = function(filter, data) {
});
child.stdout.on('end', () => {
let str = chunks.join("");
console.log("STR = ", str)
if(log_result)
console.log("STR = ", str)
try {
let parsed = JSON.parse(str);
resolve(parsed)
Expand Down

0 comments on commit 2dd4ddd

Please sign in to comment.