Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse-url 5.0.6 #28

Merged
merged 7 commits into from
Jun 25, 2021
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.
Jump to
Jump to file
Failed to load files.
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