node package manager


Parse a github repo url into an object of repo information and convert to several types of clone URL.


Utitiles to parse a github repo url to

  • an object of repo information.
  • transfer into different types of clone urls
  • convert into a link to the project.
$ npm install githuburl --save
var gu = require('githuburl');
var str = ''
// `str` could be either a scp-like syntax ssh url(as above), or http(s) url or something else. 

Then we will get:

  user: 'kaelzhang',
  repo: 'node-githuburl',
  ssh_user: 'git',
  host: '',
  // Actually the properties below are all getters, 
  // which you need not to concern about the performance. 
  http_href: '',
  https_href: '',
  http_clone_url: '',
  https_clone_url: '',
  ssh_clone_url: '',
  git_clone_url: 'git://' 

Which you don't need to worry about.

var str = '';
var parsed = gu(str, true);
// -> 'vip_account';;
// -> '' 
  • str String could be either a scp-like syntax ssh url(as above), or http(s) url or something else.

Returns Object the parsed object.