<commit_before>var fs = require('fs'),
    handlebars = require('handlebars');

var lib = {
    defaults: {
        exts: ['hbs', 'handlebars'],
        recursive: true,
        encoding: 'utf8',
        cache: true,
        knownHelpers: [] // TODO implement this
    },
    generateTemplateRegExp: function(exts) {
        var exts_re;
        if ( typeof exts == 'string' ) {
          exts_re = new RegExp("\\." + exts + "$");
        } else if ( typeof exts == 'object' && exts.length !== undefined ) {
          for(var i = 0; i < exts.length; i++) {
            exts[i] = "." + exts[i];
          }
          exts_re = new RegExp("\\" + exts.join("|") + "$");
        } else {
            throw new Error('Connect-Handlebars option exts only accepts string or array object');
        }
        return exts_re;<commit_msg>Fixing middleware capability to be used more that once. By not mutating extensions on regexp generation. Using a temp array instead.<commit_after>var fs = require('fs'),
    handlebars = require('handlebars');

var lib = {
    defaults: {
        exts: ['hbs', 'handlebars'],
        recursive: true,
        encoding: 'utf8',
        cache: true,
        knownHelpers: [] // TODO implement this
    },
    generateTemplateRegExp: function(exts) {
        var prefixed_exts = [],
            exts_re;
        if ( typeof exts == 'string' ) {
          exts_re = new RegExp("\\." + exts + "$");
        } else if ( typeof exts == 'object' && exts.length !== undefined ) {
          for(var i = 0; i < exts.length; i++) {
            prefixed_exts[i] = "." + exts[i];
          }
          exts_re = new RegExp("\\" + prefixed_exts.join("|") + "$");
        } else {
            throw new Error('Connect-Handlebars option exts only accepts string or array object');
        }
        return exts_re;
{'fraction_non_alphanumeric': 0.1495890410958904, 'fraction_numerical': 0.002191780821917808, 'mean_word_length': 2.0082372322899507, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1239019', 'n_tokens_mistral': 556, 'n_tokens_neox': 552, 'n_words': 152}