Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,12 @@ If you are using this library in one of your projects, add it in this list. :spa
- `birken-react-native-community-image-editor`
- `native-kakao-login`
- `react-native-modal-progress-bar`
- `cv-app-payment-adyen`
- `react-native-flyy`
- `react-native-dsphoto-module`
- `@hawkingnetwork/react-native-tab-view`
- `miguelcostero-ng2-toasty`
- `vue-cli-plugin-ut-builder`
- `cv-app-payment-adyen`
- `drowl-base-theme-iconset`
- `gitlab-backup-util-harduino`
- `loast`
Expand Down
18 changes: 18 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare interface ParsedUrl {
protocols: string[];
protocol: string;
port?: string;
resource: string;
user: string;
pathname: string;
hash: string;
search: string;
href: string;
query: {
[key: string]: any;
}
}

declare function parseUrl(url: string, normalize?: boolean | Object): ParsedUrl;

export default parseUrl
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function parseUrl(url, normalize = false) {
if (normalize) {
if (typeof normalize !== "object") {
normalize = {
stripFragment: false
stripHash: false
}
}
url = normalizeUrl(url, normalize)
Expand Down
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": "5.0.5",
"version": "5.0.6",
"description": "An advanced url parser supporting git urls too.",
"main": "lib/index.js",
"directories": {
Expand Down
15 changes: 14 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ const INPUTS = [
, search: ""
}
]
, [
["http://ionicabizau.net/with-true-normalize", true]
, {
protocols: [ "http" ]
, protocol: "http"
, port: null
, resource: "ionicabizau.net"
, user: ""
, pathname: "/with-true-normalize"
, hash: ""
, search: ""
}
]
];

tester.describe("check urls", test => {
Expand All @@ -80,7 +93,7 @@ tester.describe("check urls", test => {
const res = parseUrl(url, c[0][1] !== false);
if (c[0][1] !== false) {
url = normalizeUrl(url, {
stripFragment: false
stripHash: false
})
}
c[1].query = qs.parse(c[1].search)
Expand Down