<commit_before>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
function MinChunkSizePlugin(options) {
	this.options = options;
}
module.exports = MinChunkSizePlugin;

MinChunkSizePlugin.prototype.apply = function(compiler) {
	var options = this.options;
	var minChunkSize = options.minChunkSize;
	compiler.plugin("compilation", function(compilation) {
		compilation.plugin("optimize-chunks", function(chunks) {

			var combinations = [];
			chunks.forEach(function(a, idx) {
				for(var i = 0; i < idx; i++) {
					var b = chunks[i];
					combinations.push([b, a]);
				}
			});

			var equalOptions = {
				chunkOverhead: 1,
				entryChunkMultiplicator: 1
			};
			combinations = combinations.filter(function(pair) {
				return pair[0].size(equalOptions) < minChunkSize || pair[1].size(equalOptions) < minChunkSize;
			});

			if(combinations.length === 0) return;

			combinations.forEach(function(pair) {
				var a = pair[0].size(options);
				var b = pair[1].size(options);
				var ab = pair[0].integratedSize(pair[1], options);
				pair.unshift(a + b - ab, ab);
			});

			combinations = combinations.filter(function(pair) {
				return pair[1] !== false;
			});

			combinations.sort(function(a,b) {
				var diff = b[0] - a[0];
				if(diff !== 0) return diff;
				return a[1] - b[1];
			});

			var pair = combinations[0];

			pair[2].integrate(pair[3], "min-size");
			chunks.splice(chunks.indexOf(pair[3]), 1);
			this.restartApplyPlugins();
		});
	});
};
<commit_msg>fix length judgment in MinChunkSizePlugin<commit_after>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
function MinChunkSizePlugin(options) {
	this.options = options;
}
module.exports = MinChunkSizePlugin;

MinChunkSizePlugin.prototype.apply = function(compiler) {
	var options = this.options;
	var minChunkSize = options.minChunkSize;
	compiler.plugin("compilation", function(compilation) {
		compilation.plugin("optimize-chunks", function(chunks) {

			var combinations = [];
			chunks.forEach(function(a, idx) {
				for(var i = 0; i < idx; i++) {
					var b = chunks[i];
					combinations.push([b, a]);
				}
			});

			var equalOptions = {
				chunkOverhead: 1,
				entryChunkMultiplicator: 1
			};
			combinations = combinations.filter(function(pair) {
				return pair[0].size(equalOptions) < minChunkSize || pair[1].size(equalOptions) < minChunkSize;
			});

			combinations.forEach(function(pair) {
				var a = pair[0].size(options);
				var b = pair[1].size(options);
				var ab = pair[0].integratedSize(pair[1], options);
				pair.unshift(a + b - ab, ab);
			});

			combinations = combinations.filter(function(pair) {
				return pair[1] !== false;
			});
			
			if(combinations.length === 0) return;

			combinations.sort(function(a,b) {
				var diff = b[0] - a[0];
				if(diff !== 0) return diff;
				return a[1] - b[1];
			});

			var pair = combinations[0];

			pair[2].integrate(pair[3], "min-size");
			chunks.splice(chunks.indexOf(pair[3]), 1);
			this.restartApplyPlugins();
		});
	});
};

{'fraction_non_alphanumeric': 0.16291951775822744, 'fraction_numerical': 0.013685239491691105, 'mean_word_length': 3.694189602446483, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2995663', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1034, 'n_words': 196}