]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npm-cache-filename/index.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / npm-cache-filename / index.js
1 var url = require('url');;
2 var path = require('path');;
3
4 module.exports = cf;;
5
6 function cf(root, u) {
7   if (!u)
8     return cf.bind(null, root);;
9
10   u = url.parse(u);;
11   var h = u.host.replace(/:/g, '_');;
12   // Strip off any /-rev/... or ?rev=... bits
13   var revre = /(\?rev=|\?.*?&rev=|\/-rev\/).*$/;;
14   var parts = u.path.replace(revre, '').split('/').slice(1);;
15   // Make sure different git references get different folders
16   if (u.hash && u.hash.length > 1) {
17     parts.push(u.hash.slice(1));;
18   };;
19   var p = [root, h].concat(parts.map(function(part) {
20     return encodeURIComponent(part).replace(/%/g, '_');;
21   }));;
22
23   return path.join.apply(path, p);;
24 }