{"size": 582, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "mrajo/metalsmith-filter", "max_stars_repo_stars_event_min_datetime": "2016-01-26T00:43:51.000Z", "max_stars_repo_stars_event_max_datetime": "2018-02-22T16:28:50.000Z", "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "mrajo/metalsmith-filter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "mrajo/metalsmith-filter", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.28, "max_line_length": 72, "alphanum_fraction": 0.5137457045}
'use strict';

var config = require('./config.js');
var each = require('async').each;
var match = require('multimatch');
var is = require('is');

function plugin(params, mm_options) {
    var patterns = config(params);

    return function (files, metalsmith, done) {
        each(
            Object.keys(files),
            function (file, done) {
                if (is.array.empty(match(file, patterns, mm_options))) {
                    delete files[file];
                }
                done();
            },
            done
        );
    };
}

module.exports = plugin;