<commit_before>var _ = require('lodash');
var async = require('async');

var common = require('./common');
var filters = require('../filters');

var defaultOpts = {
	strict: false,
	filters: [
		filters.sort(),
		filters.select(),
		filters.paginateOffset(),
	],
};

function enumerate(chain, opts) {
	opts = _.defaults({}, opts, defaultOpts);
	chain = common.parseChain(chain);
	var lastLink = chain.pop();
	return middleware;

	function middleware(req, res, next) {
		var resource = lastLink.resource;
		var transaction = common.initTransaction(resource, res);
		_.each(opts.filters, function(filter) { filter(transaction) });
		transaction.notify(resource, 'start', req);
		async.waterfall([
			function(next) {<commit_msg>Add filter filter to enumerate default filters<commit_after>var _ = require('lodash');
var async = require('async');

var common = require('./common');
var filters = require('../filters');

var defaultOpts = {
	strict: false,
	filters: [
		filters.sort(),
		filters.filter(),
		filters.select(),
		filters.paginateOffset(),
	],
};

function enumerate(chain, opts) {
	opts = _.defaults({}, opts, defaultOpts);
	chain = common.parseChain(chain);
	var lastLink = chain.pop();
	return middleware;

	function middleware(req, res, next) {
		var resource = lastLink.resource;
		var transaction = common.initTransaction(resource, res);
		_.each(opts.filters, function(filter) { filter(transaction) });
		transaction.notify(resource, 'start', req);
		async.waterfall([
			function(next) {
{'fraction_non_alphanumeric': 0.15946843853820597, 'fraction_numerical': 0.0, 'mean_word_length': 5.048192771084337, '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': '4198441', 'n_tokens_mistral': 477, 'n_tokens_neox': 452, 'n_words': 111}