mazey
    Preparing search index...

    Function parseGitHubRepository

    • Parse a GitHub repository shorthand or transport URL.

      Accepted values include owner/name, github:owner/name, SCP-style SSH, and git, ssh, http, or https GitHub URLs with an optional git+ prefix and terminal .git suffix. Owner and repository names intentionally use a strict subset of GitHub's ASCII naming rules, including documented length bounds, and percent-encoded input is rejected.

      Usage:

      import { parseGitHubRepository } from "mazey";

      const repository = parseGitHubRepository("git@github.com:acme/widget.git");
      console.log(repository.slug, repository.url);

      Output:

      acme/widget https://github.com/acme/widget
      

      Parameters

      • value: string

        A GitHub owner/name shorthand, SCP form, or supported Git URL.

      Returns GitHubRepositoryDetails

      Canonical owner, repository name, slug, and HTTPS URL.

      TypeError when value is not a string.

      Error when the value is malformed or does not identify one GitHub repository.