<commit_before>var concat = require('concat-stream');
var reduce = require('through2-reduce');
var asyncMap = require('through2-asyncmap');
var filter = require('through2-filter');
var through = require('through2');
var jsonStream = require('JSONStream');
var isStream = require('is-stream');
var split = require('split');
var writeStreamP = require('writestreamp');
var pumpify = require('pumpify');

reduce.obj = function (fn) {
  
  return reduce.call(null, {objectMode: true}, fn);
}

exports.create = through;
exports.split = split;
exports.writeFile = writeStreamP;

exports.parse = jsonStream.parse.bind(jsonStream);
exports.stringify = jsonStream.stringify.bind(jsonStream);
exports.stringify.obj = jsonStream.stringifyObject = function (options) {
  
  options = options || {};
  
  return through.obj(function (chunk, enc, done) {
    
    done(null, JSON.stringify(chunk, null, options.space));
  });
}
exports.validate = isStream;

exports.concat = concat;
exports.compose = pumpify;

exports.reduce = reduce;
exports.filter = filter;
exports.asyncMap = asyncMap;
<commit_msg>organize reduce.obj method<commit_after>var concat = require('concat-stream');
var reduce = require('through2-reduce');
var asyncMap = require('through2-asyncmap');
var filter = require('through2-filter');
var through = require('through2');
var jsonStream = require('JSONStream');
var isStream = require('is-stream');
var split = require('split');
var writeStreamP = require('writestreamp');
var pumpify = require('pumpify');

exports.create = through;
exports.split = split;
exports.writeFile = writeStreamP;

exports.parse = jsonStream.parse.bind(jsonStream);
exports.stringify = jsonStream.stringify.bind(jsonStream);
exports.stringify.obj = jsonStream.stringifyObject = function (options) {
  
  options = options || {};
  
  return through.obj(function (chunk, enc, done) {
    
    done(null, JSON.stringify(chunk, null, options.space));
  });
}
exports.validate = isStream;

exports.concat = concat;
exports.compose = pumpify;

reduce.obj = function (fn) {
  
  return reduce.call(null, {objectMode: true}, fn);
}

exports.reduce = reduce;
exports.filter = filter;
exports.asyncMap = asyncMap;

{'fraction_non_alphanumeric': 0.1457286432160804, 'fraction_numerical': 0.003654636820465966, 'mean_word_length': 5.479289940828402, 'pattern_counts': {'":': 0, '<': 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': '3718344', 'n_tokens_mistral': 654, 'n_tokens_neox': 657, 'n_words': 152}