<commit_before>'use strict';
/*jslint vars:true*/
var fs      = require('fs');
var express = require('express');
var API_man = require("./jsweb-api-manager.js");
var init    = require("./jsweb-init.js");
var http_proxy = require('http-proxy');
 


function async_init(jw, funcs, done) {
    if (funcs.length === 0) {
        done();
    } else {
        funcs[0](jw, function () {
            funcs.shift();
            async_init(jw, funcs, done);
        });
    }
}

function load_lib(jw, lib, folder, key_path) {
    try {
        fs.readdirSync(folder).forEach(function (key) {
            var path = folder + "/" + key;
            if (fs.statSync(path).isDirectory()) {
                lib[key] = {};
                load_lib(jw, lib[key], path, key_path = key_path + '.' + key);
            } else {
                if (!/.*js$/.test(key)
                    && !/.*jso$/.test(key)) {
                    return;
                }
                try {
                    key = key.replace(/\.js$/, '');
                    var func = require(path);
                    lib[key] = func.bind(jw);
                    console.log("[jw.lib" + key_path + '.' + key + "] Loaded ..");
                } catch(e) {
                    console.error(e);
                    process.exit(1);
                }
            }
        }.bind(this));<commit_msg>load lib as object<commit_after>'use strict';
/*jslint vars:true*/
var fs      = require('fs');
var express = require('express');
var API_man = require("./jsweb-api-manager.js");
var init    = require("./jsweb-init.js");
var http_proxy = require('http-proxy');
 


function async_init(jw, funcs, done) {
    if (funcs.length === 0) {
        done();
    } else {
        funcs[0](jw, function () {
            funcs.shift();
            async_init(jw, funcs, done);
        });
    }
}

function load_lib(jw, lib, folder, key_path) {
    try {
        fs.readdirSync(folder).forEach(function (key) {
            var path = folder + "/" + key;
            if (fs.statSync(path).isDirectory()) {
                lib[key] = {};
                load_lib(jw, lib[key], path, key_path = key_path + '.' + key);
            } else {
                if (!/.*js$/.test(key)
                    && !/.*jso$/.test(key)) {
                    return;
                }
                try {
                    key = key.replace(/\.js$/, '');
                    var func = require(path);
                    if (typeof func === 'function') {
                        func = func.bind(jw);
                    }
                    lib[key] = func;
                    console.log("[jw.lib" + key_path + '.' + key + "] Loaded ..");
                } catch(e) {
                    console.error(e);
                    process.exit(1);
                }
            }
        }.bind(this));
{'fraction_non_alphanumeric': 0.1676076217360621, 'fraction_numerical': 0.002117148906139732, 'mean_word_length': 1.289983844911147, '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': '2721503', 'n_tokens_mistral': 887, 'n_tokens_neox': 847, 'n_words': 160}