JSPM

parse-git-url

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 122142
  • Score
    100M100P100Q169603F
  • License MIT

A lib for parsing the URL of Git Repositories.

Package Exports

  • parse-git-url

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parse-git-url) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

parse-git-url

A lib for parsing the URL of GitHub, GitLab, and Bitbucket repositories.

Usage

import parseGitUrl from 'parse-git-url'

parseGitUrl('https://github.com/vercel/swr'))
// => {
//   type: 'github',
//   owner: 'vercel',
//   name: 'swr',
//   branch: '',
//   sha: '',
//   subdir: ''
// }

parseGitUrl('https://google.com')
// => null

It supports parsing various URL schemas including SSH, branch, sha, commit, subdirectories, subgroups (GitLab), etc.

Author

Shu Ding (@shuding_) – Vercel