Normalize one of several GitHub URL forms to the canonical owner/name slug, or null when the input is empty, non-GitHub, or unparseable.
owner/name
null
Accepts:
https://github.com/owner/name
https://github.com/owner/name.git
git@github.com:owner/name.git
git+https://github.com/owner/name.git
github.com/owner/name
Strips a trailing .git, a git+ prefix, and any query string or fragment. Returns null for non-github.com hosts (gitlab, bitbucket, codeberg, etc.).
.git
git+
github.com
the raw URL string from a manifest (whitespace tolerated)
the canonical owner/name, or null when the URL is not a GitHub repo
normalizeRepoUrl('git+https://github.com/StoneCypher/issue_tree.git') // => 'StoneCypher/issue_tree' normalizeRepoUrl('https://gitlab.com/x/y') // => null Copy
normalizeRepoUrl('git+https://github.com/StoneCypher/issue_tree.git') // => 'StoneCypher/issue_tree' normalizeRepoUrl('https://gitlab.com/x/y') // => null
Normalize one of several GitHub URL forms to the canonical
owner/nameslug, ornullwhen the input is empty, non-GitHub, or unparseable.Accepts:
https://github.com/owner/namehttps://github.com/owner/name.gitgit@github.com:owner/name.gitgit+https://github.com/owner/name.gitgithub.com/owner/nameStrips a trailing
.git, agit+prefix, and any query string or fragment. Returnsnullfor non-github.comhosts (gitlab, bitbucket, codeberg, etc.).