Skip to content

Commit 60be372

Browse files
committed
📝 Documentation
1 parent fe61fa8 commit 60be372

File tree

2 files changed

+48
-18
lines changed

2 files changed

+48
-18
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ make the life easier and will avoid wasting time on things which are not
66
requested. :sparkles:
77

88
## Discuss the changes before doing them
9-
- First of all, open an issue in the repository, using the [bug tracker][1],
9+
- First of all, open an issue in the repository, using the [bug tracker][1]
1010
describing the contribution you'd like to make, the bug you found or any
1111
other ideas you have. This will help us to get you started on the right
1212
foot.
@@ -57,4 +57,5 @@ Finally, your contributions will be merged, and everyone will be happy! :smile:
5757
Thanks! :sweat_smile:
5858

5959
[1]: https://github.com/IonicaBizau/node-git-url-parse/issues
60+
6061
[2]: https://github.com/IonicaBizau/code-style

README.md

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# git-url-parse [![Donate now][donate-now]][paypal-donations]
1919

20-
Parses and stringifies git urls.
20+
A high level git url parser for common git providers.
2121

2222
## Installation
2323

@@ -32,26 +32,46 @@ $ npm i git-url-parse
3232
var GitUrlParse = require("git-url-parse");
3333

3434
console.log(GitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git"));
35-
// => { protocol: 'ssh'
36-
// , source: 'github.com'
37-
// , owner: 'IonicaBizau'
38-
// , name: 'node-git-url-parse'
39-
// , _: '[email protected]:IonicaBizau/node-git-url-parse.git'
40-
// , toString: [Function] }
35+
// => {
36+
// protocols: []
37+
// , port: null
38+
// , resource: "github.com"
39+
// , user: "git"
40+
// , pathname: "/IonicaBizau/node-git-url-parse.git"
41+
// , hash: ""
42+
// , search: ""
43+
// , href: "[email protected]:IonicaBizau/node-git-url-parse.git"
44+
// , token: ""
45+
// , protocol: "ssh"
46+
// , toString: [Function]
47+
// , source: "github.com"
48+
// , name: "node-git-url-parse"
49+
// , owner: "IonicaBizau"
50+
// } {
4151

4252
console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git"));
43-
// => { protocol: 'https'
44-
// , source: 'github.com'
45-
// , owner: 'IonicaBizau'
46-
// , name: 'node-git-url-parse'
47-
// , _: 'https://github.com/IonicaBizau/node-git-url-parse.git'
48-
// , toString: [Function] }
53+
// => {
54+
// protocols: ["https"]
55+
// , port: null
56+
// , resource: "github.com"
57+
// , user: ""
58+
// , pathname: "/IonicaBizau/node-git-url-parse.git"
59+
// , hash: ""
60+
// , search: ""
61+
// , href: "https://github.com/IonicaBizau/node-git-url-parse.git"
62+
// , token: ""
63+
// , protocol: "https"
64+
// , toString: [Function]
65+
// , source: "github.com"
66+
// , name: "node-git-url-parse"
67+
// , owner: "IonicaBizau"
68+
// }
4969

5070
console.log(GitUrlParse("https://github.com/IonicaBizau/node-git-url-parse.git").toString("ssh"));
51-
// => '[email protected]:IonicaBizau/node-git-url-parse.git.git'
71+
// => "[email protected]:IonicaBizau/node-git-url-parse.git"
5272

5373
console.log(GitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").toString("https"));
54-
// => 'https://github.com/IonicaBizau/node-git-url-parse.git'
74+
// => "https://github.com/IonicaBizau/node-git-url-parse.git"
5575

5676
```
5777

@@ -65,12 +85,21 @@ Parses a Git url.
6585

6686
#### Return
6787
- **GitUrl** The `GitUrl` object containing:
68-
- `protocol` (String): The url protocol.
88+
- `protocols` (Array): An array with the url protocols (usually it has one element).
89+
- `port` (null|Number): The domain port.
90+
- `resource` (String): The url domain (including subdomains).
91+
- `user` (String): The authentication user (usually for ssh urls).
92+
- `pathname` (String): The url pathname.
93+
- `hash` (String): The url hash.
94+
- `search` (String): The url querystring value.
95+
- `href` (String): The input url.
96+
- `protocol` (String): The git url protocol.
97+
- `token` (String): The oauth token (could appear in the https urls).
6998
- `source` (String): The Git provider (e.g. `"github.com"`).
7099
- `owner` (String): The repository owner.
71100
- `name` (String): The repository name.
72-
- `_` (String): The original url which was parsed.
73101
- `toString` (Function): A function to stringify the parsed url into another url type.
102+
- `organization` (String): The organization the owner belongs to. This is CloudForge specific.
74103

75104
### `stringify(obj, type)`
76105
Stringifies a `GitUrl` object.

0 commit comments

Comments
 (0)