Parse URL and return result with username, repo, type, branch, filename of github
$ npm install --save pathize-github-url
const pathizeGithubUrl = require('pathize-github-url');
pathizeGithubUrl('https://raw.githubusercontent.com/ragingwind/mobile-chromeapp-starter-kit/patch/gulpfile.js');
//=>
{
root: 'raw.githubusercontent.com',
dir: '',
base: 'gulpfile.js', // file or dir
name: 'gulpfile',
ext: '.js',
paths: [Array],
url: [Object],
username: 'ragingwind', // username or organization of github url
repo: 'mobile-chromeapp-starter-kit', // repo name of github url
type: 'blob', // type of github url
branch: 'patch' // branch name of github url
}
pathizeGithubUrl('https://github.com/ragingwind/mobile-chromeapp-starter-kit/blob/master/src/platform/config.xml');
//=>
{
root: 'github.com',
dir: 'src/platform',
base: 'config.xml',
name: 'config',
ext: '.xml',
paths: [Array],
url: [Object],
username: 'ragingwind',
repo: 'mobile-chromeapp-starter-kit',
type: 'blob',
branch: 'master'
}
Type: string
URL related to github to parse.
MIT © ragingwind