+12
-2
@@ -108,3 +108,6 @@ var nodeUrl = require('url'); | ||
| var pieces = this.path().split("/"); | ||
| pieces.pop(); | ||
| var popped = pieces.pop(); | ||
| if (popped === ''){ // ignore trailing slash | ||
| pieces.pop(); | ||
| } | ||
| return this.path(pieces.join("/")); | ||
@@ -119,3 +122,10 @@ }; | ||
| // if no suffix, return the child | ||
| return _.last(this.path().split("/")); | ||
| var pieces = this.path().split("/"); | ||
| var last = _.last(pieces); | ||
| if ((pieces.length > 1) && (last === '')){ | ||
| // ignore trailing slashes | ||
| pieces.pop(); | ||
| last = _.last(pieces); | ||
| } | ||
| return last; | ||
| } | ||
@@ -122,0 +132,0 @@ }; |
+1
-1
@@ -5,3 +5,3 @@ { | ||
| "keywords" : ["url", "uri"], | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "bugs": { | ||
@@ -8,0 +8,0 @@ "url": "https://github.com/cainus/urlgrey/issues" |
+9
-0
@@ -118,2 +118,7 @@ var should = require('should'); | ||
| }); | ||
| it("ignores a trailing slash", function(){ | ||
| var url = "http://asdf.com/path/kid/?asdf=1234#frag"; | ||
| urlgrey(url).parent() | ||
| .toString().should.equal('http://asdf.com/path?asdf=1234#frag'); | ||
| }); | ||
| }); | ||
@@ -130,2 +135,6 @@ describe("#child", function(){ | ||
| }); | ||
| it("ignores a trailing slash", function(){ | ||
| var url = "http://asdf.com/path/kid/?asdf=1234#frag"; | ||
| urlgrey(url).child().should.equal('kid'); | ||
| }); | ||
| }); | ||
@@ -132,0 +141,0 @@ describe("#toString", function(){ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
30069
2.19%415
4.8%