fast-uri 0.0.1 → 0.0.2
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/.github/workflows/ci.yml +1 -1
- package/README.md +23 -18
- package/benchmark.js +8 -0
- package/index.d.ts +2 -1
- package/index.js +0 -3
- package/index.test-d.ts +6 -0
- package/package.json +12 -1
- package/test/compatibility.test.js +2 -1
package/.github/workflows/ci.yml
CHANGED
package/README.md
CHANGED
|
@@ -94,24 +94,29 @@ fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_sch
|
|
|
94
94
|
## Benchmarks
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
fast-uri: parse domain x 1,
|
|
98
|
-
urijs: parse domain x
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
fast-uri: parse
|
|
104
|
-
urijs: parse
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fast-uri:
|
|
110
|
-
urijs:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
97
|
+
fast-uri: parse domain x 1,306,864 ops/sec ±0.31% (100 runs sampled)
|
|
98
|
+
urijs: parse domain x 483,001 ops/sec ±0.09% (99 runs sampled)
|
|
99
|
+
WHATWG URL: parse domain x 862,461 ops/sec ±0.18% (97 runs sampled)
|
|
100
|
+
fast-uri: parse IPv4 x 2,381,452 ops/sec ±0.26% (96 runs sampled)
|
|
101
|
+
urijs: parse IPv4 x 384,705 ops/sec ±0.34% (99 runs sampled)
|
|
102
|
+
WHATWG URL: parse IPv4 NOT SUPPORTED
|
|
103
|
+
fast-uri: parse IPv6 x 923,519 ops/sec ±0.09% (100 runs sampled)
|
|
104
|
+
urijs: parse IPv6 x 289,070 ops/sec ±0.07% (95 runs sampled)
|
|
105
|
+
WHATWG ULR: parse IPv6 NOT SUPPORTED
|
|
106
|
+
fast-uri: parse URN x 2,596,395 ops/sec ±0.42% (98 runs sampled)
|
|
107
|
+
urijs: parse URN x 1,152,412 ops/sec ±0.09% (97 runs sampled)
|
|
108
|
+
WHATWG URL: parse URN x 1,183,307 ops/sec ±0.38% (100 runs sampled)
|
|
109
|
+
fast-uri: parse URN uuid x 1,666,861 ops/sec ±0.10% (98 runs sampled)
|
|
110
|
+
urijs: parse URN uuid x 852,724 ops/sec ±0.17% (95 runs sampled)
|
|
111
|
+
WHATWG URL: parse URN uuid NOT SUPPORTED
|
|
112
|
+
fast-uri: serialize uri x 1,741,499 ops/sec ±0.57% (95 runs sampled)
|
|
113
|
+
urijs: serialize uri x 389,014 ops/sec ±0.28% (93 runs sampled)
|
|
114
|
+
fast-uri: serialize IPv6 x 441,095 ops/sec ±0.37% (97 runs sampled)
|
|
115
|
+
urijs: serialize IPv6 x 255,443 ops/sec ±0.58% (94 runs sampled)
|
|
116
|
+
fast-uri: serialize ws x 1,448,667 ops/sec ±0.25% (97 runs sampled)
|
|
117
|
+
urijs: serialize ws x 352,884 ops/sec ±0.08% (96 runs sampled)
|
|
118
|
+
fast-uri: resolve x 340,084 ops/sec ±0.98% (98 runs sampled)
|
|
119
|
+
urijs: resolve x 225,759 ops/sec ±0.37% (95 runs sampled)
|
|
115
120
|
```
|
|
116
121
|
|
|
117
122
|
## TODO
|
package/benchmark.js
CHANGED
|
@@ -15,6 +15,10 @@ suite.add('fast-uri: parse domain', function () {
|
|
|
15
15
|
suite.add('urijs: parse domain', function () {
|
|
16
16
|
urijs.parse('https://example.com')
|
|
17
17
|
})
|
|
18
|
+
suite.add('WHATWG URL: parse domain', function () {
|
|
19
|
+
// eslint-disable-next-line
|
|
20
|
+
new URL('https://example.com')
|
|
21
|
+
})
|
|
18
22
|
suite.add('fast-uri: parse IPv4', function () {
|
|
19
23
|
fasturi.parse('//10.10.10.10')
|
|
20
24
|
})
|
|
@@ -33,6 +37,10 @@ suite.add('fast-uri: parse URN', function () {
|
|
|
33
37
|
suite.add('urijs: parse URN', function () {
|
|
34
38
|
urijs.parse('urn:foo:a123,456')
|
|
35
39
|
})
|
|
40
|
+
suite.add('WHATWG URL: parse URN', function () {
|
|
41
|
+
// eslint-disable-next-line
|
|
42
|
+
new URL('urn:foo:a123,456')
|
|
43
|
+
})
|
|
36
44
|
suite.add('fast-uri: parse URN uuid', function () {
|
|
37
45
|
fasturi.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
|
|
38
46
|
})
|
package/index.d.ts
CHANGED
|
@@ -15,11 +15,12 @@ export interface options {
|
|
|
15
15
|
unicodeSupport?: boolean;
|
|
16
16
|
domainHost?: boolean;
|
|
17
17
|
absolutePath?: boolean;
|
|
18
|
+
tolerant?:boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function parse(uri: string, opts?: options): URIComponents;
|
|
21
22
|
|
|
22
|
-
export function serialize(component: URIComponents): string;
|
|
23
|
+
export function serialize(component: URIComponents, opts?: options): string;
|
|
23
24
|
|
|
24
25
|
export function equal(uriA: string, uriB:string): boolean;
|
|
25
26
|
|
package/index.js
CHANGED
|
@@ -276,9 +276,6 @@ function parse (uri, opts) {
|
|
|
276
276
|
if (parsed.path !== undefined && parsed.path.length) {
|
|
277
277
|
parsed.path = escape(parsed.path)
|
|
278
278
|
}
|
|
279
|
-
if (gotEncoding && parsed.query !== undefined && parsed.query.length) {
|
|
280
|
-
parsed.query = unescape(parsed.query)
|
|
281
|
-
}
|
|
282
279
|
if (parsed.fragment !== undefined && parsed.fragment.length) {
|
|
283
280
|
parsed.fragment = escape(parsed.fragment)
|
|
284
281
|
}
|
package/index.test-d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-uri",
|
|
3
|
-
"
|
|
3
|
+
"description": "Dependency free RFC 3986 URI toolbox",
|
|
4
|
+
"version": "0.0.2",
|
|
4
5
|
"main": "index.js",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
5
8
|
"license": "MIT",
|
|
6
9
|
"author": "Vincent Le Goff <vince.legoff@gmail.com> (https://github.com/zekth)",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/fastify/fast-uri"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/fastify/fast-uri/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage":"https://github.com/fastify/fast-uri",
|
|
7
18
|
"scripts": {
|
|
8
19
|
"bench": "node benchmark.js",
|
|
9
20
|
"lint:fix": "standard --fix",
|
|
@@ -31,7 +31,8 @@ test('compatibility Parse', (t) => {
|
|
|
31
31
|
'urn:example:%D0%B0123,z456',
|
|
32
32
|
'//[2606:2800:220:1:248:1893:25c8:1946:43209]',
|
|
33
33
|
'http://foo.bar',
|
|
34
|
-
'http://'
|
|
34
|
+
'http://',
|
|
35
|
+
'//?json=%7B%22foo%22%3A%22bar%22%7D'
|
|
35
36
|
// 'mailto:chris@example.com'-203845,
|
|
36
37
|
// 'mailto:infobot@example.com?subject=current-issue',
|
|
37
38
|
// 'mailto:infobot@example.com?body=send%20current-issue',
|