[parse-github-short-url][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url]

July 19, 2016 ยท View on GitHub

Parse a github/npm shorthand (user/repo#branch or user/repo@version) URL into an object.

code climate standard code style travis build status coverage status dependency status

Install

npm i parse-github-short-url --save

Usage

For more use-cases see the tests

var gh = require('parse-github-short-url')
gh('tunnckoCore/parse-function')

Results in:

{
  "owner": "tunnckoCore",
  "name": "parse-function",
  "repo": "tunnckoCore/parse-function",
  "branch": null,
}

More examples

Or see the tests

// assemble/verb#1.2.3
{
  "owner": "assemble",
  "name": "verb",
  "repo": "assemble/verb",
  "branch": "1.2.3",
}

// assemble/verb@~3.0.5
{
  "owner": "assemble",
  "name": "verb",
  "repo": "assemble/verb",
  "branch": null,
  "version": "~3.0.5"
}

// assemble/verb#dev
{
  "owner": "assemble",
  "name": "verb",
  "repo": "assemble/verb",
  "branch": "dev",
}

// assemble/verb
{
  "owner": "assemble",
  "name": "verb",
  "repo": "assemble/verb",
  "branch": null,
}

// assemble
{
  "owner": "assemble",
  "name": null,
  "repo": null,
  "branch": null,
}

// gulpjs/gulp@v3.8.1
{
  "owner": "gulpjs",
  "name": "gulp",
  "repo": "gulpjs/gulp",
  "branch": null,
  "version": "v3.8.1"
}

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github