diff options
Diffstat (limited to 'deps/npm/node_modules/github-url-from-username-repo/index.js')
-rw-r--r-- | deps/npm/node_modules/github-url-from-username-repo/index.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/deps/npm/node_modules/github-url-from-username-repo/index.js b/deps/npm/node_modules/github-url-from-username-repo/index.js index 60ed7aa4e..794daabf3 100644 --- a/deps/npm/node_modules/github-url-from-username-repo/index.js +++ b/deps/npm/node_modules/github-url-from-username-repo/index.js @@ -1,9 +1,12 @@ module.exports = getUrl -function getUrl (r) { +function getUrl (r, forBrowser) { if (!r) return null - if (/^[\w-]+\/[\w\.-]+$/.test(r)) + if (/^[\w-]+\/[\w\.-]+(#[a-z0-9]*)?$/.test(r)) { + if (forBrowser) + r = r.replace("#", "/tree/") return "https://github.com/" + r - else - return null + } + + return null } |