quasiurl 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -8
- package/index.ts +7 -11
- package/package.json +1 -1
- package/tsconfig.json +6 -3
package/dist/index.js
CHANGED
|
@@ -13,14 +13,12 @@ var QuasiURL = class {
|
|
|
13
13
|
return `${this.origin}${this.pathname}${this.search}${this.hash}`;
|
|
14
14
|
}
|
|
15
15
|
set href(value) {
|
|
16
|
-
let
|
|
17
|
-
let tail = value.match(
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.search = tail?.[1] ?? "";
|
|
23
|
-
this.hash = tail?.[2] ?? "";
|
|
16
|
+
let origin = value.match(/^(\w+:)?\/\/[^/:]+(:\d+)?/)?.[0] ?? "";
|
|
17
|
+
let tail = value.slice(origin.length).match(/^([^?#]+)?(\?[^#]+)?(#.+)?$/) ?? [];
|
|
18
|
+
this.origin = origin;
|
|
19
|
+
this.pathname = tail[1] ?? "";
|
|
20
|
+
this.search = tail[2] ?? "";
|
|
21
|
+
this.hash = tail[3] ?? "";
|
|
24
22
|
}
|
|
25
23
|
get protocol() {
|
|
26
24
|
return this._protocol;
|
package/index.ts
CHANGED
|
@@ -17,18 +17,14 @@ export class QuasiURL {
|
|
|
17
17
|
return `${this.origin}${this.pathname}${this.search}${this.hash}`;
|
|
18
18
|
}
|
|
19
19
|
set href(value: string) {
|
|
20
|
-
let
|
|
21
|
-
let tail =
|
|
20
|
+
let origin = value.match(/^(\w+:)?\/\/[^/:]+(:\d+)?/)?.[0] ?? "";
|
|
21
|
+
let tail =
|
|
22
|
+
value.slice(origin.length).match(/^([^?#]+)?(\?[^#]+)?(#.+)?$/) ?? [];
|
|
22
23
|
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
.replace(/^(\w+:)?\/\/[^/:]+(:\d+)?/, "")
|
|
28
|
-
.replace(/\?.*$/, "")
|
|
29
|
-
.replace(/#.*$/, "");
|
|
30
|
-
this.search = tail?.[1] ?? "";
|
|
31
|
-
this.hash = tail?.[2] ?? "";
|
|
24
|
+
this.origin = origin;
|
|
25
|
+
this.pathname = tail[1] ?? "";
|
|
26
|
+
this.search = tail[2] ?? "";
|
|
27
|
+
this.hash = tail[3] ?? "";
|
|
32
28
|
}
|
|
33
29
|
get protocol() {
|
|
34
30
|
return this._protocol;
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"include": ["index.ts", "tests.ts"],
|
|
2
|
+
"include": ["./index.ts", "./tests.ts"],
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
"noEmit": true,
|
|
4
5
|
"lib": ["ESNext", "DOM"],
|
|
5
|
-
"target": "
|
|
6
|
+
"target": "esnext",
|
|
6
7
|
"outDir": "dist",
|
|
7
|
-
"
|
|
8
|
+
"module": "nodenext",
|
|
9
|
+
"moduleResolution": "nodenext",
|
|
10
|
+
"allowImportingTsExtensions": true,
|
|
8
11
|
"strict": true,
|
|
9
12
|
"noUnusedLocals": true,
|
|
10
13
|
"noUnusedParameters": true
|