Comparing version 0.0.7 to 0.0.8
@@ -162,4 +162,7 @@ var nodeUrl = require('url'); | ||
if (popped === ''){ // ignore trailing slash | ||
pieces.pop(); | ||
popped = pieces.pop(); | ||
} | ||
if (!popped){ | ||
throw new Error("The current path has no parent path"); | ||
} | ||
return this.query(false).hash('').path(pieces.join("/")); | ||
@@ -166,0 +169,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"keywords" : ["url", "uri"], | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"bugs": { | ||
@@ -8,0 +8,0 @@ "url": "https://github.com/cainus/urlgrey/issues" |
@@ -149,2 +149,11 @@ var should = require('should'); | ||
}); | ||
it("throws an exception when no parent path exists", function(){ | ||
var url = "http://asdf.com/"; | ||
try { | ||
urlgrey(url).parent(); | ||
should.fail("expected exception was not raised."); | ||
} catch (ex){ | ||
ex.message.should.equal('The current path has no parent path'); | ||
} | ||
}); | ||
}); | ||
@@ -151,0 +160,0 @@ describe("#rawChild", function(){ |
49404
562