<commit_before>'use strict';

var handlers = [];

function NodeCG(bundleName, io) {
    this.bundleName = bundleName;

    io.sockets.on('connection', function onConnection(socket) {
        socket.on('message', function onMessage(data, cb) {
            for (var i = 0; i < handlers.length; i++) {
                var handler = handlers[i];
                if (data.messageName === handler.messageName &&
                    data.bundleName === handler.bundleName) {
                    handler.func(data.content, cb);
                }
            }
        });
    });

    var config = {};
    Object.defineProperty( this, 'config', {
        value: require('../config'),
        writable: false,
        enumerable: true
    });
}

NodeCG.prototype.sendMessage = function (messageName, data, callback) {
    if (typeof callback === "undefined" && typeof data === "function") {
        callback = data;
        data = null;
    }

    io.sockets.json.send({
        bundleName: bundleName,
        messageName: messageName,<commit_msg>Store socket.io instance so other funcs can actually use it<commit_after>'use strict';

var handlers = [];
var io = {};

function NodeCG(bundleName, ioInstance) {
    this.bundleName = bundleName;

    io = ioInstance;

    io.sockets.on('connection', function onConnection(socket) {
        socket.on('message', function onMessage(data, cb) {
            for (var i = 0; i < handlers.length; i++) {
                var handler = handlers[i];
                if (data.messageName === handler.messageName &&
                    data.bundleName === handler.bundleName) {
                    handler.func(data.content, cb);
                }
            }
        });
    });

    var config = {};
    Object.defineProperty( this, 'config', {
        value: require('../config'),
        writable: false,
        enumerable: true
    });
}

NodeCG.prototype.sendMessage = function (messageName, data, callback) {
    if (typeof callback === "undefined" && typeof data === "function") {
        callback = data;
        data = null;
    }

    io.sockets.json.send({
        bundleName: bundleName,
        messageName: messageName,
{'fraction_non_alphanumeric': 0.13428703276419013, 'fraction_numerical': 0.0009229349330872173, 'mean_word_length': 2.0664780763790667, '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': '743201', 'n_tokens_mistral': 607, 'n_tokens_neox': 581, 'n_words': 142}