🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

githuburl

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

githuburl

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

0.1.6
latest
npm
Version published
Weekly downloads
761
-19.73%
Maintainers
1
Weekly downloads
 
Created
Source

githuburl NPM version Build Status Dependency Status

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.

Installation

$ npm install githuburl --save

Usage

var gu = require('githuburl');
var str = 'git@github.com:kaelzhang/node-githuburl.git'
// `str` could be either a scp-like syntax ssh url(as above), or http(s) url or something else.

gu(str);

Then we will get:

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

Also prepared for complex cases

Which you don't need to worry about.

var str = 'https://vip_account@abc.github.com/kaelzhang/node-githuburl.git';
var parsed = gu(str, true);

parsed.ssh_user;
// -> 'vip_account';

parsed.host;
// -> 'abc.github.com'

gu(str)

  • 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.

Keywords

github

FAQs

Package last updated on 03 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts