<commit_before>var Promise = require('es6-promise').Promise;
var engine = require('static-engine');

module.exports = function (name, plugins) {

    return function (pages) {

        var promises = pages.map(function (page) {

            return new Promise(function(resolve, reject){

                var current_pages = page[name] && Array.isArray(page[name]) ? page[name] : [];

                var _plugins = Array.prototype.slice.apply(plugins);

                _plugins.unshift(function(){

                    return Promise.resolve(current_pages);
                });

                engine([_plugins]).then(function (pages) {

                    page[name] = pages[0];

                    resolve(page);
                });
            });
        });

        return Promise.all(promises).then(function(results){

            var pages = [];

            Array.prototype.push.apply(pages, results);

            return Promise.resolve(pages);
        });
    };
};<commit_msg>Improve naming of a variable<commit_after>var Promise = require('es6-promise').Promise;
var engine = require('static-engine');

module.exports = function (name, plugins) {

    return function (pages) {

        var promises = pages.map(function (page) {

            return new Promise(function(resolve, reject){

                var current_pages = page[name] && Array.isArray(page[name]) ? page[name] : [];

                var formula = [ plugins.slice(0) ];

                formula[0].unshift(function(){

                    return Promise.resolve(current_pages);
                });

                engine(formula).then(function (pages) {

                    page[name] = pages[0];

                    resolve(page);
                });
            });
        });

        return Promise.all(promises).then(function(results){

            var pages = [];

            Array.prototype.push.apply(pages, results);

            return Promise.resolve(pages);
        });
    };
};
{'fraction_non_alphanumeric': 0.13225643614336194, 'fraction_numerical': 0.003028773346794548, 'mean_word_length': 1.756606397774687, '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': '3237238', 'n_tokens_mistral': 528, 'n_tokens_neox': 480, 'n_words': 94}