varpath=require('path');module.exports=function(basedir,relfiles){if(relfiles){varfiles=relfiles.map(function(r){returnpath.resolve(basedir,r);});}else{varfiles=basedir;}varres=files.slice(1).reduce(function(ps,file){if(!file.match(/^([A-Za-z]:)?\/|\\/)){thrownewError('relative path without a basedir');}varxs=file.split(/\/+|\\+/);for(vari=0;ps[i]===xs[i]&&i<Math.min(ps.length,xs.length);i++);returnps.slice(0,i);},files[0].split(/\/+|\\+/));// Windows correctly handles paths with forward-slashesreturnres.length>1?res.join('/'):'/'};