<commit_before>
var cli = require('./cliutils');
var jop = require('./processor');

if (cli.showHelp) {
    cli.usage();
    process.exit(0);
}

var json = cli.jsonContentAsStream();
var jsonContent = ""  // '[{"name":"Andrea","age":19},{"name":"Beatrice", "age": 21},{"name":"Carlo", "age":16}]';
var indent = 2;

json.on('data', function(chunk){
    jsonContent += chunk;
});

json.on('end', function(){
    try {
        var out = jop.processContent(jsonContent, cli.instructions(), cli.debug);
        console.log( cli.prettyprint ? JSON.stringify(out, undefined, indent) : JSON.stringify(out));
    } catch (e) {
        if (console.debug) {
            console.trace(e.toString());
        } else {
            console.log(e.toString())
        }
    }
});<commit_msg>main moved back to lib<commit_after>
var cli = require('./cliutils');
var jop = require('./processor');

if (cli.showHelp) {
    cli.usage();
    process.exit(0);
}

var json = cli.jsonContentAsStream();
var jsonContent = "";
var indent = 2;

json.on('data', function(chunk){
    jsonContent += chunk;
});

json.on('end', function(){
    try {
        var out = jop.processContent(jsonContent, cli.instructions(), cli.debug);
        console.log( cli.prettyprint ? JSON.stringify(out, undefined, indent) : JSON.stringify(out));
    } catch (e) {
        if (console.debug) {
            console.trace(e.toString());
        } else {
            console.log(e.toString())
        }
    }
});
{'fraction_non_alphanumeric': 0.1919398907103825, 'fraction_numerical': 0.006830601092896175, 'mean_word_length': 2.9487870619946093, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1112453', 'n_tokens_mistral': 485, 'n_tokens_neox': 474, 'n_words': 96}