<commit_before>goog.provide('rethinkdb.Connection');

goog.require('rethinkdb.errors');
goog.require('goog.math.Long');
goog.require('goog.proto2.WireFormatSerializer');

/**
 * As this is an abstract class you cannot use this constructor directly.
 * Construct instances of TcpConnection or HttpConnection instead.
 * @class A connection over which queries may be sent.
 * This is an abstract base class for two different kinds of connections,
 * a tcp connection or an http connection (for use by browsers).
 * @param {?string|Object} host Either a string giving the host to connect to or
 *      an object specifying host and/or port and/or db for the default database to
 *      use on this connection. Any key not supplied will revert to the default.
 * @param {?function(Error)=} opt_errorHandler optional error handler to use for this connection
 * @constructor
 */
rethinkdb.Connection = function(host, opt_errorHandler) {
    if (typeof host === undefined) {
        host = {};
    } else if (typeof host === 'string') {
        host = {'host':host};
    }

    this.host_ = host['host'] || this.DEFAULT_HOST;
    this.port_ = host['port'] || this.DEFAULT_PORT;
    this.db_   = host['db']   || this.DEFAULT_DB;

    typeCheck_(this.host_, 'string');
    typeCheck_(this.port_, 'number');
    typeCheck_(this.db_,   'string');

    this.outstandingQueries_ = {};
    this.nextToken_ = 1;

    this.errorHandler_ = opt_errorHandler || null;
<commit_msg>js client, fixes small bug in connection<commit_after>goog.provide('rethinkdb.Connection');

goog.require('rethinkdb.errors');
goog.require('goog.math.Long');
goog.require('goog.proto2.WireFormatSerializer');

/**
 * As this is an abstract class you cannot use this constructor directly.
 * Construct instances of TcpConnection or HttpConnection instead.
 * @class A connection over which queries may be sent.
 * This is an abstract base class for two different kinds of connections,
 * a tcp connection or an http connection (for use by browsers).
 * @param {?string|Object} host Either a string giving the host to connect to or
 *      an object specifying host and/or port and/or db for the default database to
 *      use on this connection. Any key not supplied will revert to the default.
 * @param {?function(Error)=} opt_errorHandler optional error handler to use for this connection
 * @constructor
 */
rethinkdb.Connection = function(host, opt_errorHandler) {
    if (typeof host === 'undefined') {
        host = {};
    } else if (typeof host === 'string') {
        host = {'host':host};
    }

    this.host_ = host['host'] || this.DEFAULT_HOST;
    this.port_ = host['port'] || this.DEFAULT_PORT;
    this.db_   = host['db']   || this.DEFAULT_DB;

    typeCheck_(this.host_, 'string');
    typeCheck_(this.port_, 'number');
    typeCheck_(this.db_,   'string');

    this.outstandingQueries_ = {};
    this.nextToken_ = 1;

    this.errorHandler_ = opt_errorHandler || null;

{'fraction_non_alphanumeric': 0.11623178583531006, 'fraction_numerical': 0.0013554727211114877, 'mean_word_length': 3.768982229402262, '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': '925780', 'n_tokens_mistral': 850, 'n_tokens_neox': 818, 'n_words': 292}