Simple TCP connection string parser

npm install connection-parse
131 downloads in the last day
1 040 downloads in the last week
4 905 downloads in the last month


Simple TCP connection string parser, and nothing more then that. It simply transforms in to a simple parsed object. I seem to do this a lot in most of my modules such as hashring, memcached and failover. So it makes sense to extract this in to a small util.


Install this module using npm:

npm install connection-parse --save

The --save automatically adds the package and version to your package.json.


var parse = require('connection-parse');

parse('', '');
parse(['', '']);
parse({ '': 100 });

  servers: [{
    string: '',
    host: '',
    port: 1111
  regular: [''],
  weighted: {
    '': 100 // or 1 by default

// It also accepts custom parsers
parse.merge(function (data) { = 'bar';
  return data;

Then the server instances will also have an extra property, `foo`.



npm loves you