lib/client.js
function Client(opts) {
    if (!(this instanceof Client)) {
        return new Client(opts);
    }

    var options = {};

    // If single connection provided, array-ify it
    if (typeof opts === 'string') {
        options.hosts = [opts];
        opts = options;
    } else if (typeof opts === 'undefined') {
        opts = {};
    } else if (_.isArray(opts)) {
        options.hosts = opts;
        opts = options;
    }

    _.defaults(opts, {
        autodiscover: false,
        bufferBeforeError: 1000,
        disabled: false,
        hosts: null,
        reconnect: true,
        onNetError: function onNetError(err) { console.error(err); },
        queue: true,
        netTimeout: 500,
        backoffLimit: 10000,
        maxValueSize: 1048576
    });

    // Iterate over options, assign each to this object
    R.keys(opts).forEach(function(key) {
        this[key] = opts[key];
    }, this);

    if (this.queue) {
        this.buffer = new Immutable.List();
    }

    debug('Connect options', opts);
    this.connect();
}
function Client(opts) {
    if (!(this instanceof Client)) {
        return new Client(opts);
    }

    var options = {};

    // If single connection provided, array-ify it
    if (typeof opts === 'string') {
        options.hosts = [opts];
        opts = options;
    } else if (typeof opts === 'undefined') {
        opts = {};
    } else if (_.isArray(opts)) {
        options.hosts = opts;
        opts = options;
    }

    _.defaults(opts, {
        autodiscover: false,
        bufferBeforeError: 1000,
        disabled: false,
        hosts: null,
        reconnect: true,
        onNetError: function onNetError(err) { console.error(err); },
        queue: true,
        netTimeout: 500,
        backoffLimit: 10000,
        maxValueSize: 1048576
    });

    // Iterate over options, assign each to this object
    R.keys(opts).forEach(function(key) {
        this[key] = opts[key];
    }, this);

    if (this.queue) {
        this.buffer = new Immutable.List();
    }

    debug('Connect options', opts);
    this.connect();
}
function Client ( opts ) { if ( ! ( this instanceof Client ) ) { return new Client ( opts ) ; } var options = { } ; // If single connection provided, array-ify it if ( typeof opts === 'string' ) { options . hosts = [ opts ] ; opts = options ; } else if ( typeof opts === 'undefined' ) { opts = { } ; } else if ( _ . isArray ( opts ) ) { options . hosts = opts ; opts = options ; } _ . defaults ( opts , { autodiscover : false , bufferBeforeError : 1000 , disabled : false , hosts : null , reconnect : true , onNetError : function onNetError ( err ) { console . error ( err ) ; } , queue : true , netTimeout : 500 , backoffLimit : 10000 , maxValueSize : 1048576 } ) ; // Iterate over options, assign each to this object R . keys ( opts ) . forEach ( function ( key ) { this [ key ] = opts [ key ] ; } , this ) ; if ( this . queue ) { this . buffer = new Immutable . List ( ) ; } debug ( 'Connect options' , opts ) ; this . connect ( ) ; }
Constructor - Initiate client
Constructor - Initiate client