@vbarbarosh/node-helpers 3.77.0 → 3.78.1
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/README.md +1 -1
- package/dist/browser.js +1 -1
- package/dist/index.html +8 -16
- package/package.json +5 -5
- package/src/crypto_decrypt_aes256.js +43 -7
- package/src/crypto_decrypt_aes256.md +15 -10
- package/src/crypto_encrypt_aes256.js +23 -9
- package/src/crypto_encrypt_aes256.md +20 -10
- package/src/escape_content_disposition.js +8 -2
- package/src/escape_content_disposition.md +10 -2
- package/src/escape_content_disposition_utf8.js +11 -0
- package/src/escape_content_disposition_utf8.md +11 -0
- package/src/fastdl.js +7 -1
- package/src/fastdl.md +5 -0
- package/src/format_date_fs.js +8 -0
- package/src/format_error_report.js +102 -4
- package/src/format_error_report.md +47 -0
- package/src/http_get_stream_range.js +5 -1
- package/src/http_get_stream_range.md +2 -1
- package/src/http_stream_range.js +14 -1
- package/src/http_stream_range.md +3 -1
- package/src/make_progress.js +16 -9
- package/src/make_progress.md +7 -4
- package/src/pgid_exists.js +5 -0
- package/src/pgid_exists.md +4 -0
- package/src/pgid_kill_grace.js +5 -0
- package/src/pgid_kill_grace.md +3 -0
- package/src/pid_exists.js +5 -0
- package/src/pid_exists.md +4 -0
- package/src/pid_kill_grace.js +5 -0
- package/src/pid_kill_grace.md +3 -0
- package/src/redis_poll_zshift_callback_rpush.js +4 -0
- package/src/redis_poll_zshift_callback_rpush.md +4 -3
- package/src/redis_poll_zshift_spawn_rpush.js +4 -0
- package/src/redis_poll_zshift_spawn_rpush.md +4 -3
- package/src/shell.js +1 -1
- package/src/shell.md +2 -1
- package/src/shell_json.js +1 -1
- package/src/shell_json.md +2 -1
- package/src/stream_strpbrk.js +9 -1
- package/src/stream_xml_analyze.js +6 -1
- package/src/stream_xml_parse.js +11 -3
- package/src/urlmod.md +3 -1
- package/src/urlparts.js +111 -15
- package/src/urlparts.md +44 -12
package/src/urlparts.md
CHANGED
|
@@ -1,17 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Parses an absolute or relative URL-like string into a stable object shape.
|
|
2
|
+
Missing scalar components are `null`. `search` and `hash` preserve their
|
|
3
|
+
delimiters, while `query` and `fragment` are always parsed plain objects.
|
|
4
|
+
|
|
5
|
+
Malformed URL text is accepted and parsed on a best-effort basis. A non-string
|
|
6
|
+
argument returns the empty stable shape instead of throwing.
|
|
7
|
+
|
|
8
|
+
**Warning:** `host` (like every other component) is a tolerant best-effort
|
|
9
|
+
value intended for display and lenient parsing. It is not guaranteed to match
|
|
10
|
+
the host a WHATWG client (browsers, Node's `URL`, Axios) would connect to for
|
|
11
|
+
malformed input, so it must not be used for allow-lists, redirect-target
|
|
12
|
+
validation, or SSRF decisions. Use `new URL(input)` for security checks.
|
|
5
13
|
|
|
6
14
|
```js
|
|
7
|
-
urlparts('
|
|
15
|
+
urlparts('/users?a=1#top')
|
|
16
|
+
// {
|
|
17
|
+
// protocol: null,
|
|
18
|
+
// username: null,
|
|
19
|
+
// password: null,
|
|
20
|
+
// host: null,
|
|
21
|
+
// port: null,
|
|
22
|
+
// path: '/users',
|
|
23
|
+
// search: '?a=1',
|
|
24
|
+
// hash: '#top',
|
|
25
|
+
// query: {a: '1'},
|
|
26
|
+
// fragment: {top: ''},
|
|
27
|
+
// }
|
|
28
|
+
|
|
29
|
+
urlparts('https://john:secret@example.com:8080/users?page=2')
|
|
8
30
|
// {
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// host: 'example.com
|
|
13
|
-
//
|
|
31
|
+
// protocol: 'https',
|
|
32
|
+
// username: 'john',
|
|
33
|
+
// password: 'secret',
|
|
34
|
+
// host: 'example.com',
|
|
35
|
+
// port: '8080',
|
|
36
|
+
// path: '/users',
|
|
37
|
+
// search: '?page=2',
|
|
38
|
+
// hash: null,
|
|
39
|
+
// query: {page: '2'},
|
|
40
|
+
// fragment: {},
|
|
14
41
|
// }
|
|
15
|
-
urlparts('/users?page=5').path // '/users'
|
|
16
|
-
urlparts('/users?page=5').protocol // 'fake:'
|
|
17
42
|
```
|
|
43
|
+
|
|
44
|
+
Duplicate query or fragment parameters use the last value. Parameter values
|
|
45
|
+
without `=` are normalized to `''`, matching explicitly empty values. Missing
|
|
46
|
+
`search` and `hash` values are `null`; present-but-empty delimiters are `'?'`
|
|
47
|
+
and `'#'`. Their parsed `query` and `fragment` objects remain `{}` when empty or
|
|
48
|
+
absent. Special parameter names such as `__proto__` are preserved as ordinary
|
|
49
|
+
own properties without changing the object prototype. An empty path is `null`.
|