<commit_before>'use strict';

var compact    = require('es5-ext/lib/Array/prototype/compact')
  , i          = require('es5-ext/lib/Function/i')
  , partial    = require('es5-ext/lib/Function/prototype/partial')
  , mapToArray = require('es5-ext/lib/Object/map-to-array')
  , callable   = require('es5-ext/lib/Object/valid-callable')
  , value      = require('es5-ext/lib/Object/valid-value')
  , numPad     = require('es5-ext/lib/Number/prototype/pad')
  , pad        = require('es5-ext/lib/String/prototype/pad')
  , repeat     = require('es5-ext/lib/String/prototype/repeat')
  , memoize    = require('memoizee')
  , deferred   = require('deferred')
  , clc        = require('cli-color')
  , readFile   = require('next/lib/fs/read-file')
  , normalize  = require('./_normalize-source')

  , isArray = Array.isArray
  , ceil = Math.ceil, max = Math.max, min = Math.min
  , log = process.stdout.write.bind(process.stdout)
  , nextTick = process.nextTick
  , reportFile, isStatus

  , eolRe = /(?:\r\n|[\n\r\u2028\u2029])/

  , Reporter;

Reporter = function () {};
Reporter.prototype = {
	parsed: 0,
	failed: 0,
	errors: 0,
	all: 0,
	init: function (data, options) {
		var waiting, status, isStatus;
		if (options.progress) {
			waiting = [];
			status = memoize(function () {  nextTick(function () {
				status.clear();
				this.status();
				isStatus = true;
			}.bind(this)); }.bind(this));

			data.on('change', function (event) {
				this.calc(event.report);
				waiting.push(this.normalize(event.report)(function (report) {
					if (report) {
						if (isStatus) {
							log(clc.bol(-3, true));
							isStatus = false;
						}
						this.file(event.name, report);
						status();
					}
				}.bind(this)));
			}.bind(this));
			return data(function () {
				return deferred.map(waiting);
			}.bind(this));
		} else {
			return data(function (data) {
				return deferred.map(mapToArray(data, function (report, name) {
					this.calc(report);
					return this.normalize(report)(function (report) {
						if (report) {
							this.file(name, report);
						}
					}.bind(this));
				}, this));
			}.bind(this))(this.status.bind(this));
		}
	},
	emap: {
		report: {
			name: clc.bold,
			options: clc.gray,

			count: clc.xterm(232),
			messageErr: clc.yellow,
			lineNum: clc.xterm(240),
			code: clc.xterm(250),
			at: clc.xterm(250).bgXterm(235),
			messageOK: clc.green
		},
		status: {
			OK: i,
			failed: clc.bold.red,
			errors: clc.red
		}
	},
	options: function (options) {
		var escape = this.emap.report.options;
		options = compact.call(mapToArray(options, function (value, name) {
			if (value === true) {
				return name;
			} else if (value === false) {
				return null;
			} else {
				return name + '=' + value;
			}
		}));
		return escape('[' +
			(options.nlength ? options.join('|') : 'no options')  + ']');
	},<commit_msg>Fix typo<commit_after>'use strict';

var compact    = require('es5-ext/lib/Array/prototype/compact')
  , i          = require('es5-ext/lib/Function/i')
  , partial    = require('es5-ext/lib/Function/prototype/partial')
  , mapToArray = require('es5-ext/lib/Object/map-to-array')
  , callable   = require('es5-ext/lib/Object/valid-callable')
  , value      = require('es5-ext/lib/Object/valid-value')
  , numPad     = require('es5-ext/lib/Number/prototype/pad')
  , pad        = require('es5-ext/lib/String/prototype/pad')
  , repeat     = require('es5-ext/lib/String/prototype/repeat')
  , memoize    = require('memoizee')
  , deferred   = require('deferred')
  , clc        = require('cli-color')
  , readFile   = require('next/lib/fs/read-file')
  , normalize  = require('./_normalize-source')

  , isArray = Array.isArray
  , ceil = Math.ceil, max = Math.max, min = Math.min
  , log = process.stdout.write.bind(process.stdout)
  , nextTick = process.nextTick
  , reportFile, isStatus

  , eolRe = /(?:\r\n|[\n\r\u2028\u2029])/

  , Reporter;

Reporter = function () {};
Reporter.prototype = {
	parsed: 0,
	failed: 0,
	errors: 0,
	all: 0,
	init: function (data, options) {
		var waiting, status, isStatus;
		if (options.progress) {
			waiting = [];
			status = memoize(function () {  nextTick(function () {
				status.clear();
				this.status();
				isStatus = true;
			}.bind(this)); }.bind(this));

			data.on('change', function (event) {
				this.calc(event.report);
				waiting.push(this.normalize(event.report)(function (report) {
					if (report) {
						if (isStatus) {
							log(clc.bol(-3, true));
							isStatus = false;
						}
						this.file(event.name, report);
						status();
					}
				}.bind(this)));
			}.bind(this));
			return data(function () {
				return deferred.map(waiting);
			}.bind(this));
		} else {
			return data(function (data) {
				return deferred.map(mapToArray(data, function (report, name) {
					this.calc(report);
					return this.normalize(report)(function (report) {
						if (report) {
							this.file(name, report);
						}
					}.bind(this));
				}, this));
			}.bind(this))(this.status.bind(this));
		}
	},
	emap: {
		report: {
			name: clc.bold,
			options: clc.gray,

			count: clc.xterm(232),
			messageErr: clc.yellow,
			lineNum: clc.xterm(240),
			code: clc.xterm(250),
			at: clc.xterm(250).bgXterm(235),
			messageOK: clc.green
		},
		status: {
			OK: i,
			failed: clc.bold.red,
			errors: clc.red
		}
	},
	options: function (options) {
		var escape = this.emap.report.options;
		options = compact.call(mapToArray(options, function (value, name) {
			if (value === true) {
				return name;
			} else if (value === false) {
				return null;
			} else {
				return name + '=' + value;
			}
		}));
		return escape('[' +
			(options.length ? options.join('|') : 'no options')  + ']');
	},
{'fraction_non_alphanumeric': 0.17990161630358398, 'fraction_numerical': 0.013000702740688685, 'mean_word_length': 2.851826792963464, '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': '730501', 'n_tokens_mistral': 2436, 'n_tokens_neox': 2045, 'n_words': 361}