<commit_before>// Copyright 2013 <NAME>, Inc.  All rights reserved.

var EventEmitter = require('events').EventEmitter;
var net = require('net');
var util = require('util');

var assert = require('assert-plus');

var SyslogStream = require('./sys');




///--- Globals

var PROXY_EVENTS = [
        'connect',
        'data',
        'drain',
        'end',
        'timeout'
];



///--- Helpers

function createSocket(opts) {
        assert.object(opts, 'options');
        assert.string(opts.host, 'options.host');
        assert.number(opts.port, 'options.port');
        assert.object(opts.proxy, 'options.proxy');

        var s = net.connect({
                host: opts.host,
                port: opts.port
        });

        PROXY_EVENTS.forEach(function (e) {
                s.on(e, EventEmitter.prototype.emit.bind(opts.proxy, e));
        });

        return (s);
}



///--- API<commit_msg>opts.proxy is TCPStream which inherited from EventEmitter, it always has an emit method, so use it instead of EventEmitter.prototype.emit<commit_after>// Copyright 2013 <NAME>, Inc.  All rights reserved.

var net = require('net');
var util = require('util');

var assert = require('assert-plus');

var SyslogStream = require('./sys');




///--- Globals

var PROXY_EVENTS = [
        'connect',
        'data',
        'drain',
        'end',
        'timeout'
];



///--- Helpers

function createSocket(opts) {
        assert.object(opts, 'options');
        assert.string(opts.host, 'options.host');
        assert.number(opts.port, 'options.port');
        assert.object(opts.proxy, 'options.proxy');

        var s = net.connect({
                host: opts.host,
                port: opts.port
        });

        PROXY_EVENTS.forEach(function (e) {
                s.on(e, opts.proxy.emit.bind(opts.proxy, e));
        });

        return (s);
}



///--- API
{'fraction_non_alphanumeric': 0.16213333333333332, 'fraction_numerical': 0.004266666666666667, 'mean_word_length': 2.0703764320785596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4953901', 'n_tokens_mistral': 591, 'n_tokens_neox': 563, 'n_words': 128}