<commit_before>var fs = require('fs');
var path = require('path');
var utils = require('./utils');

function setup(namespace, filepath) {
    if(!fs.existsSync(filepath))
        return;
    var filenames = fs.readdirSync(filepath);
    filenames.forEach(function(filename) {
        var pos = filename.lastIndexOf('.');
        if(pos < 1)
            return;
        var prefix = filename.substr(0, pos);
        var stuffix = filename.substr(pos + 1);
        if(stuffix != "js")
            return;
        utils.nsBind(namespace, path.join(filepath, prefix), function(key, value) {
            return true;
        });
    });
};

exports.setup = setup;<commit_msg>Modify commons export rule<commit_after>var fs = require('fs');
var path = require('path');
var utils = require('./utils');

function setup(namespace, filepath) {
    if(!fs.existsSync(filepath))
        return;
    var filenames = fs.readdirSync(filepath);
    filenames.forEach(function(filename) {
        var pos = filename.lastIndexOf('.');
        if(pos < 1)
            return;
        var prefix = filename.substr(0, pos);
        var stuffix = filename.substr(pos + 1);
        if(stuffix != "js")
            return;
        utils.nsBind(namespace, path.join(filepath, prefix), function(key, value) {
            var usage = false;
            switch(typeof value) {
            case "number":
                usage = key == key.toUpperCase();
                break;
            case "function":
                usage = true;
                break;
            }
            return usage;
        });
    });
};

exports.setup = setup;
{'fraction_non_alphanumeric': 0.13675742574257427, 'fraction_numerical': 0.0037128712871287127, 'mean_word_length': 2.0451977401129944, 'pattern_counts': {'":': 2, '<': 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': '2918040', 'n_tokens_mistral': 466, 'n_tokens_neox': 460, 'n_words': 106}