mirror of https://github.com/nodejs/node.git
13 lines
320 B
JavaScript
13 lines
320 B
JavaScript
var re = /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/
|
|
|
|
module.exports = function(url){
|
|
try {
|
|
var m = re.exec(url.replace(/\.git$/, ''));
|
|
var host = m[1];
|
|
var path = m[2];
|
|
return 'https://' + host + '/' + path;
|
|
} catch (err) {
|
|
// ignore
|
|
}
|
|
};
|