"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm-cache-filename/index.js" (8 Mar 2017, 661 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 }