我想知道如果
function pathJoin(uri,file){
return url.format(
url.parse(
path.normalize(
path.join(uri, file)
).split(
path.delimiter
).join("/")
)
);
}
和
function pathJoin(uri,file){
var joined_path = path.join(uri, file);
var normalized = path.normalize( joined_path );
var splitted = normalized.split(path.delimiter);
var joined = splitted.join("/");
var parsed = url.parse(joined);
return url.format(parsed);
}
将执行同样快。多次从功能切换到功能没有任何惩罚吗?