mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 17:51:35 +00:00
13 lines
245 B
JavaScript
13 lines
245 B
JavaScript
module.exports = getUrl
|
|
|
|
function getUrl (r, forBrowser) {
|
|
if (!r) return null
|
|
if (/^[\w-]+\/[\w\.-]+(#[a-z0-9]*)?$/.test(r)) {
|
|
if (forBrowser)
|
|
r = r.replace("#", "/tree/")
|
|
return "https://github.com/" + r
|
|
}
|
|
|
|
return null
|
|
}
|