get-github-url
Get a complete (or a canonical) GitHub repository URL (https or ssh) from an incomplete URL or a user/repo path
Installation
$ npm install get-github-url --save
Usage
var getGithubUrl = ; // HTTPS;// => 'https://github.com/facebook/react';// => 'https://github.com/facebook/react';// => 'https://github.com/facebook/react';// => 'https://github.com/facebook/react' // SSH; // => 'git@github.com:facebook/react.git'; // => 'git@github.com:facebook/react.git';// => 'git@github.com:facebook/react.git';// => 'git@github.com:facebook/react.git' // Prepare URL for cloning:;// => 'https://github.com/facebook/react.git';// => 'git@github.com:facebook/react.git'
API
getGithubUrl(input, options)
Get a complete (or a canonical) GitHub repository URL (https or ssh) from an incomplete URL or a user/repo path
Params
- String
input
: a URL or a user/repo path - Object
options
: An object containing the following fields:protocol
(String): A format of returned URL. Possible values:ssh
(https is used by default)cloning
(Boolean): Make a URL acceptable forgit clone
command
Return
- String | Null: A valid GitHub URL or null
License
MIT © Philipp Alferov