git-url-parse
Advanced tools
Comparing version
@@ -27,2 +27,5 @@ "use strict"; | ||
* - `name` (String): The repository name. | ||
* - `ref` (String): The repository ref (e.g., "master" or "dev"). | ||
* - `filepath` (String): A filepath relative to the repository root. | ||
* - `filepathtype` (String): The type of filepath in the url ("blob" or "tree"). | ||
* - `full_name` (String): The owner and name values in the `owner/name` format. | ||
@@ -60,6 +63,17 @@ * - `toString` (Function): A function to stringify the parsed url into another url type. | ||
splits = urlInfo.name.split("/"); | ||
if (splits.length === 2) { | ||
if (splits.length >= 2) { | ||
urlInfo.owner = splits[0]; | ||
urlInfo.name = splits[1]; | ||
} | ||
urlInfo.ref = ""; | ||
urlInfo.filepathtype = ""; | ||
urlInfo.filepath = ""; | ||
if (splits.length > 3 && ["blob", "tree"].indexOf(splits[2]) >= 0) { | ||
urlInfo.filepathtype = splits[2]; | ||
urlInfo.ref = splits[3]; | ||
if (splits.length > 4) { | ||
urlInfo.filepath = splits.slice(4).join('/'); | ||
} | ||
} | ||
break; | ||
@@ -66,0 +80,0 @@ } |
{ | ||
"name": "git-url-parse", | ||
"version": "7.0.2", | ||
"version": "7.1.0", | ||
"description": "A high level git url parser for common git providers.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -67,2 +67,23 @@ <!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --> | ||
console.log(GitUrlParse("https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js")); | ||
// { protocols: [ 'https' ], | ||
// protocol: 'https', | ||
// port: null, | ||
// resource: 'github.com', | ||
// user: '', | ||
// pathname: '/IonicaBizau/git-url-parse/blob/master/test/index.js', | ||
// hash: '', | ||
// search: '', | ||
// href: 'https://github.com/IonicaBizau/git-url-parse/blob/master/test/index.js', | ||
// token: '', | ||
// toString: [Function], | ||
// source: 'github.com', | ||
// name: 'git-url-parse', | ||
// owner: 'IonicaBizau', | ||
// organization: '', | ||
// ref: 'master', | ||
// filepathtype: 'blob', | ||
// filepath: 'test/index.js', | ||
// full_name: 'IonicaBizau/git-url-parse' } | ||
console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git").toString("ssh")); | ||
@@ -113,2 +134,5 @@ // => "git@github.com:IonicaBizau/node-git-url-parse.git" | ||
- `name` (String): The repository name. | ||
- `ref` (String): The repository ref (e.g., "master" or "dev"). | ||
- `filepath` (String): A filepath relative to the repository root. | ||
- `filepathtype` (String): The type of filepath in the url ("blob" or "tree"). | ||
- `full_name` (String): The owner and name values in the `owner/name` format. | ||
@@ -142,2 +166,3 @@ - `toString` (Function): A function to stringify the parsed url into another url type. | ||
- Starring and sharing the projects you like :rocket: | ||
@@ -151,2 +176,3 @@ - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book: | ||
Thanks! :heart: | ||
@@ -178,2 +204,3 @@ | ||
- [`generator-openapi-repo`](https://github.com/rebilly/generator-openapi-repo#readme) (by Roman Hotsiy)—Yeoman generator for OpenAPI(fka Swagger) repo to help you share spec for your API | ||
- [`git-cherry-fix`](https://npmjs.com/package/git-cherry-fix)—> helps you get your fixes to another branch by cherry-picking them | ||
- [`git-issues`](https://github.com/softwarescales/git-issues) (by Gabriel Petrovay)—Git issues extension to list issues of a Git project | ||
@@ -188,4 +215,6 @@ - [`git-lab-cli`](https://npmjs.com/package/git-lab-cli)—gitlab-cli ================== | ||
- [`gitbook-start-plugin-iaas-ull-es-noejaco2017`](http://creacion-de-paquetes-y-modulos-en-nodejs-noejaco2017/README.md) (by alu0100622492)—Despliegue plugin Iaas | ||
- [`gitc`](https://github.com/cezarlz/gitc#readme) (by Cezar Luiz)—Manage your pull requests and issues from your command line. | ||
- [`github-publish-npm`](https://github.com/ofersadgat/github-publish-npm) (by Ofer Sadgat)—This will upload publish npm assets to the GitHub Releases API. | ||
- [`gitlab-ci-variables-setter-cli`](https://github.com/temando/gitlab-ci-variables-cli#readme) (by Khoa Tran)—CLI tool to allow setting multiple pipeline variables on Gitlab CI. | ||
- [`gitline`](https://github.com/cezarlz/gitline#readme) (by Cezar Luiz)—Manage your pull requests and issues from your command line. | ||
- [`gtni`](https://nmrony.github.io/gtni) (by Nur Mohammed Rony)—Install your all npm dependencies recursively with gtni while you are doing git clone, fetch or pull | ||
@@ -209,10 +238,11 @@ - [`lcov-server`](https://github.com/gabrielcsapo/lcov-server#readme) (by Gabriel J. Csapo)—🎯 A simple lcov server & cli parser | ||
[badge_patreon]: http://ionicabizau.github.io/badges/patreon.svg | ||
[badge_amazon]: http://ionicabizau.github.io/badges/amazon.svg | ||
[badge_paypal]: http://ionicabizau.github.io/badges/paypal.svg | ||
[badge_paypal_donate]: http://ionicabizau.github.io/badges/paypal_donate.svg | ||
[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg | ||
[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg | ||
[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg | ||
[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg | ||
[patreon]: https://www.patreon.com/ionicabizau | ||
[amazon]: http://amzn.eu/hRo9sIZ | ||
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RVXDDLKKLQRJW | ||
[donate-now]: http://i.imgur.com/6cMbHOC.png | ||
@@ -219,0 +249,0 @@ [license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(https%3A%2F%2Fionicabizau.net)&year=2015#license-mit |
Sorry, the diff of this file is not supported yet
20707
10.05%126
11.5%246
13.89%