npm-cache-filename
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,3 +12,6 @@ var url = require('url');; | ||
var h = u.host.replace(/:/g, '_');; | ||
var p = [root, h].concat(u.path.split('/').slice(1).map(function(part) { | ||
// Strip off any /-rev/... or ?rev=... bits | ||
var revre = /(\?rev=|\?.*?&rev=|\/-rev\/).*$/ | ||
var parts = u.path.replace(revre, '').split('/').slice(1) | ||
var p = [root, h].concat(parts.map(function(part) { | ||
return encodeURIComponent(part).replace(/%/g, '_');; | ||
@@ -15,0 +18,0 @@ }));; |
{ | ||
"name": "npm-cache-filename", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Given a cache folder and url, return the appropriate cache folder.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,3 +12,11 @@ var test = require('tap').test;; | ||
t.equal(cf("/tmp", "https://foo:134/xyz/-rev/baz"), | ||
'/tmp/foo_134/xyz') | ||
t.equal(cf("/tmp", "https://foo:134/xyz/?rev=baz"), | ||
'/tmp/foo_134/xyz') | ||
t.equal(cf("/tmp", "https://foo:134/xyz/?foo&rev=baz"), | ||
'/tmp/foo_134/xyz') | ||
t.equal(cf("/tmp", "https://foo:134/xyz-rev/baz"), | ||
'/tmp/foo_134/xyz-rev/baz') | ||
t.end(); | ||
});; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3197
34