Skip to content

Commit

Permalink
⬆️ 7.0.1 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Jun 27, 2022
1 parent e0ac69f commit c6e6991
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
40 changes: 28 additions & 12 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,62 @@
const parseUrl = require("../lib")

console.log(parseUrl("http://ionicabizau.net/blog"))
// { protocols: [ 'http' ],
// {
// protocols: [ 'http' ],
// protocol: 'http',
// port: null,
// port: '',
// resource: 'ionicabizau.net',
// user: '',
// password: '',
// pathname: '/blog',
// hash: '',
// search: '',
// href: 'http://ionicabizau.net/blog' }
// href: 'http://ionicabizau.net/blog',
// query: {}
// }

console.log(parseUrl("http://domain.com/path/name?foo=bar&bar=42#some-hash"))
// { protocols: [ 'http' ],
// {
// protocols: [ 'http' ],
// protocol: 'http',
// port: null,
// port: '',
// resource: 'domain.com',
// user: '',
// password: '',
// pathname: '/path/name',
// hash: 'some-hash',
// search: 'foo=bar&bar=42',
// href: 'http://domain.com/path/name?foo=bar&bar=42#some-hash' }
// href: 'http://domain.com/path/name?foo=bar&bar=42#some-hash',
// query: { foo: 'bar', bar: '42' }
// }

// If you want to parse fancy Git urls, turn off the automatic url normalization
console.log(parseUrl("git+ssh://git@host.xz/path/name.git", false))
// { protocols: [ 'git', 'ssh' ],
// {
// protocols: [ 'git', 'ssh' ],
// protocol: 'git',
// port: null,
// port: '',
// resource: 'host.xz',
// user: 'git',
// password: '',
// pathname: '/path/name.git',
// hash: '',
// search: '',
// href: 'git+ssh://git@host.xz/path/name.git' }
// href: 'git+ssh://git@host.xz/path/name.git',
// query: {}
// }

console.log(parseUrl("git@github.com:IonicaBizau/git-stats.git", false))
// { protocols: [],
// {
// protocols: [ 'ssh' ],
// protocol: 'ssh',
// port: null,
// port: '',
// resource: 'github.com',
// user: 'git',
// password: '',
// pathname: '/IonicaBizau/git-stats.git',
// hash: '',
// search: '',
// href: 'git@github.com:IonicaBizau/git-stats.git' }
// href: 'git@github.com:IonicaBizau/git-stats.git',
// query: {}
// }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-url",
"version": "7.0.0",
"version": "7.0.1",
"description": "An advanced url parser supporting git urls too.",
"main": "lib/index.js",
"directories": {
Expand Down

0 comments on commit c6e6991

Please sign in to comment.