Skip to content

Commit

Permalink
shorthand url test passes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Jan 15, 2012
1 parent fe15be7 commit 48d7d1d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/parse_args.js
@@ -1,4 +1,5 @@
var net = require('net');
var url = require('url');

module.exports = function (args) {
var opts = {};
Expand All @@ -11,7 +12,12 @@ module.exports = function (args) {
}
else if (typeof arg === 'string') {
if (/^\d+$/.test(arg)) opts.port = parseInt(arg, 10)
else if (/\//.test(arg)) opts.unix = arg
else if (/^\.?\//.test(arg)) opts.unix = arg
else if (/^:\d+(\/.+)?$/.test(arg)) {
var m = arg.match(/^:(\d+)(\/.+)?/);
opts.port = parseInt(m[1], 10);
if (m[2]) opts.path = m[2];
}
else opts.host = arg;
}
else if (typeof arg === 'object') {
Expand Down

0 comments on commit 48d7d1d

Please sign in to comment.