<commit_before>var fs = require('fs');
var path = require('path');

module.exports = function(pathName, extension, callback) {
	fs.readdir(pathName, function(err, list) {
		if (err) {
			callback(err, null);
		}
		else {
			var results = [];
			// for (var i = 0; i < list.length; i++) {				
			// 	console.log(path.extname(list[i]));
			// 	console.log(extension)
			// 	if(path.extname(list[i]) == extension) {
			// 		results.push(entry);
			// 		console.log(results);
			// 	}
			// }

			list.forEach(function(entry) {
				if(path.extname(entry) == extension) {
					results.push(entry);
				}
			});
			callback(null, results);
		}
	});
};<commit_msg>add working solution<commit_after>var fs = require('fs');
var path = require('path');

module.exports = function(pathName, extension, callback) {
	fs.readdir(pathName, function(err, list) {
		if (err) {
			callback(err, null);
		}
		else {
			var results = [];
			list.forEach(function(entry) {
				if(path.extname(entry) == extension) {
					results.push(entry);
				}
			});
			
			callback(null, results);
		}
	});
};
{'fraction_non_alphanumeric': 0.1894150417827298, 'fraction_numerical': 0.0009285051067780873, 'mean_word_length': 3.007434944237918, 'pattern_counts': {'":': 0, '<': 4, '<?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': '4373857', 'n_tokens_mistral': 459, 'n_tokens_neox': 384, 'n_words': 67}