Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-cache-filename

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-cache-filename - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

5

index.js

@@ -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 @@ }));;

2

package.json
{
"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();
});;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc