Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Commit

Permalink
Removes clutter code
Browse files Browse the repository at this point in the history
  • Loading branch information
dscape committed Nov 6, 2014
1 parent e0c128c commit b20f4fc
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions lib/nano.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,30 +717,14 @@ module.exports = exports = nano = function dbScope(cfg) {

var path = u.parse(cfg.url);
var pathArray = path.pathname.split('/').filter(function(e) { return e; });
var db = path.pathname && pathArray[0];

if (path.pathname && pathArray.length > 0) {

auth = path.auth ? path.auth : '';
var port = path.port ? ':' + path.port : '';
var db = pathArray[0];

var format = {
protocol: path.protocol,
host: path.hostname + port
};

if (auth) {
format.auth = auth;
}

cfg.url = u.format(format);

if (db) {
cfg.url = cfg.url.replace('/' + db, '');
return docModule(db);
}
else {
return serverScope;
}

return serverScope;
};

/*
Expand Down

0 comments on commit b20f4fc

Please sign in to comment.