<commit_before>"use strict";


/**
 * RegExp to find placeholders in the template
 *
 * http://regexr.com/3e1o7
 * @type {RegExp}
 */
const _re = /{([0-9a-zA-Z]+?)}/g;


/**
 * Micro template compiler
 *
 * @param {string} template
 * @param {array|object} values
 * @returns {string}
 */
const crouch = ( template, values ) => {
    let match;

    // Loop through all the placeholders that matched with regex
    while ( match = _re.exec( template ) ) {
        let _value = values[ match[ 1 ] ];
        if ( !_value ) _value = "";

        // Replace the placeholder with a real value.
        template = template.replace( match[ 0 ], _value )
    }

    return template;
};


/*
 * Export
 */
module.exports = crouch;<commit_msg>[major] Convert from es6 to es5<commit_after>"use strict";


/**
 * RegExp to find placeholders in the template
 *
 * http://regexr.com/3e1o7
 * @type {RegExp}
 */
var _re = /{([0-9a-zA-Z]+?)}/g;


/**
 * Micro template compiler
 *
 * @param {string} template
 * @param {array|object} values
 * @returns {string}
 */
var crouch = function ( template, values ) {
    /*
     * Default arguments
     */
    var
        template = template || "",
        values   = values || {};

    var match;

    /*
     * Loop through all the placeholders that matched with regex
     */
    while ( match = _re.exec( template ) ) {
        var _value = values[ match[ 1 ] ];
        if ( !_value ) _value = "";

        /*
         * Replace the placeholder with a real value.
         */
        template = template.replace( match[ 0 ], _value )
    }

    /*
     * Return the template with filled in values
     */
    return template;
};


/*
 * Export
 */
module.exports = crouch;
{'fraction_non_alphanumeric': 0.14528412419449327, 'fraction_numerical': 0.009373169302870533, 'mean_word_length': 2.1925233644859814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '6659784', 'n_tokens_mistral': 560, 'n_tokens_neox': 528, 'n_words': 159}