<commit_before>/**
 * CommonJS module definition implementation for use in browser 
 * environments.
 *
 * @author  <NAME>
 * @see https://github.com/bgrohman/cardboard.js for details.
 */
(function(globals) {

    var modules = {};
    globals.exports = {};

    /**
     * Returns the module associated with the given module id.
     * @param moduleId
     * @throws exception when the module is missing
     */
    function require(moduleId) {
        if (typeof modules[moduleId] === 'undefined') {
            throw "Missing module '" + moduleId + "'";
        }

        return modules[moduleId];
    }

    /**
     * Defines a module.
     * @param moduleId
     * @param dependencies  optional array of module ids
     * @param definition    object, or function that returns an object
     * or uses the global export object to set properties.
     */
    function define(/*moduleId, dependencies, definition*/) {
        var moduleId = arguments[0],
            dependencies,
            definition,
            module,
            definitionReturn,
            dependencyObjects = [],
            len,
            i;

        if (arguments.length < 2 || arguments.length > 3) {
            throw "Wrong number of arguments";
        } else if (arguments.length === 2) {
            dependencies = [];
            definition = arguments[1];
        } else {
            dependencies = arguments[1];
            definition = arguments[2];
        }

        if (!(dependencies instanceof Array)) {
            throw "Expected array of dependencies";
        }

        globals.exports = {};

        if (typeof definition === 'function') {
            for (i = 0, len = dependencies.length; i < len; i++) {
                if (dependencies[i] === 'require') {
                    dependencyObjects.push(require);
                } else if (dependencies[i] === 'exports') {
                    dependencyObjects.push(globals.exports);
                } else {
                    dependencyObjects.push(require(dependencies[i]));
                }
            }

            if (dependencyObjects.length === 0) {
                dependencyObjects = [require, globals.exports];
            }

            definitionReturn = definition.apply(null, dependencyObjects);
            module = definitionReturn || globals.exports;
        } else {
            module = definition;
        }

        if (module) {
            modules[moduleId] = module;
        }
    }

    globals.require = require;
    globals.define = define;
    globals.cardboard = {
        require: require,
        define: define,
        debug: function() {
            console.log('cardboard.js debug:');
            console.log(modules);
        }
    };

})(window);<commit_msg>Added exports object to cardboard object<commit_after>/**
 * CommonJS module definition implementation for use in browser 
 * environments.
 *
 * @author  <NAME>
 * @see https://github.com/bgrohman/cardboard.js for details.
 */
(function(globals) {

    var modules = {},
        exports = {};

    /**
     * Returns the module associated with the given module id.
     * @param moduleId
     * @throws exception when the module is missing
     */
    function require(moduleId) {
        if (typeof modules[moduleId] === 'undefined') {
            throw "Missing module '" + moduleId + "'";
        }

        return modules[moduleId];
    }

    /**
     * Defines a module.
     * @param moduleId
     * @param dependencies  optional array of module ids
     * @param definition    object, or function that returns an object
     * or uses the global export object to set properties.
     */
    function define(/*moduleId, dependencies, definition*/) {
        var moduleId = arguments[0],
            dependencies,
            definition,
            module,
            definitionReturn,
            dependencyObjects = [],
            len,
            i;

        if (arguments.length < 2 || arguments.length > 3) {
            throw "Wrong number of arguments";
        } else if (arguments.length === 2) {
            dependencies = [];
            definition = arguments[1];
        } else {
            dependencies = arguments[1];
            definition = arguments[2];
        }

        if (!(dependencies instanceof Array)) {
            throw "Expected array of dependencies";
        }

        globals.exports = {};

        if (typeof definition === 'function') {
            for (i = 0, len = dependencies.length; i < len; i++) {
                if (dependencies[i] === 'require') {
                    dependencyObjects.push(require);
                } else if (dependencies[i] === 'exports') {
                    dependencyObjects.push(globals.exports);
                } else {
                    dependencyObjects.push(require(dependencies[i]));
                }
            }

            if (dependencyObjects.length === 0) {
                dependencyObjects = [require, globals.exports];
            }

            definitionReturn = definition.apply(null, dependencyObjects);
            module = definitionReturn || globals.exports;
        } else {
            module = definition;
        }

        if (module) {
            modules[moduleId] = module;
        }
    }

    globals.require = require;
    globals.define = define;
    globals.exports = exports;
    globals.cardboard = {
        require: require,
        define: define,
        exports: exports,
        debug: function() {
            console.log('cardboard.js debug:');
            console.log(modules);
        }
    };

})(window);
{'fraction_non_alphanumeric': 0.11075384065737763, 'fraction_numerical': 0.003215434083601286, 'mean_word_length': 1.6983132530120482, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3989077', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1345, 'n_words': 374}