query-string 7.0.0 → 7.0.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/index.js +7 -3
- package/package.json +1 -1
- package/readme.md +29 -1
package/index.js
CHANGED
|
@@ -6,6 +6,8 @@ const filterObject = require('filter-obj');
|
|
|
6
6
|
|
|
7
7
|
const isNullOrUndefined = value => value === null || value === undefined;
|
|
8
8
|
|
|
9
|
+
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');
|
|
10
|
+
|
|
9
11
|
function encoderForArrayFormat(options) {
|
|
10
12
|
switch (options.arrayFormat) {
|
|
11
13
|
case 'index':
|
|
@@ -402,7 +404,8 @@ exports.parseUrl = (url, options) => {
|
|
|
402
404
|
exports.stringifyUrl = (object, options) => {
|
|
403
405
|
options = Object.assign({
|
|
404
406
|
encode: true,
|
|
405
|
-
strict: true
|
|
407
|
+
strict: true,
|
|
408
|
+
[encodeFragmentIdentifier]: true
|
|
406
409
|
}, options);
|
|
407
410
|
|
|
408
411
|
const url = removeHash(object.url).split('?')[0] || '';
|
|
@@ -417,7 +420,7 @@ exports.stringifyUrl = (object, options) => {
|
|
|
417
420
|
|
|
418
421
|
let hash = getHash(object.url);
|
|
419
422
|
if (object.fragmentIdentifier) {
|
|
420
|
-
hash = `#${encode(object.fragmentIdentifier, options)}`;
|
|
423
|
+
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`;
|
|
421
424
|
}
|
|
422
425
|
|
|
423
426
|
return `${url}${queryString}${hash}`;
|
|
@@ -425,7 +428,8 @@ exports.stringifyUrl = (object, options) => {
|
|
|
425
428
|
|
|
426
429
|
exports.pick = (input, filter, options) => {
|
|
427
430
|
options = Object.assign({
|
|
428
|
-
parseFragmentIdentifier: true
|
|
431
|
+
parseFragmentIdentifier: true,
|
|
432
|
+
[encodeFragmentIdentifier]: false
|
|
429
433
|
}, options);
|
|
430
434
|
|
|
431
435
|
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
<br>
|
|
23
23
|
<br>
|
|
24
|
+
<br>
|
|
24
25
|
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=query-string&utm_source=github">
|
|
25
26
|
<div>
|
|
26
27
|
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
|
|
@@ -32,6 +33,25 @@
|
|
|
32
33
|
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
|
|
33
34
|
</div>
|
|
34
35
|
</a>
|
|
36
|
+
<br>
|
|
37
|
+
<a href="https://strapi.io/?ref=sindresorhus">
|
|
38
|
+
<div>
|
|
39
|
+
<img src="https://sindresorhus.com/assets/thanks/strapi-logo-white-bg.png" width="200" alt="Strapi">
|
|
40
|
+
</div>
|
|
41
|
+
<b>Strapi is the leading open-source headless CMS.</b>
|
|
42
|
+
<div>
|
|
43
|
+
<sup>It’s 100% JavaScript, fully customizable, and developer-first.</sup>
|
|
44
|
+
</div>
|
|
45
|
+
</a>
|
|
46
|
+
<br>
|
|
47
|
+
<a href="https://oss.capital">
|
|
48
|
+
<div>
|
|
49
|
+
<img src="https://sindresorhus.com/assets/thanks/oss-capital-logo-white-bg.svg" width="300" alt="OSS Capital">
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
<sup><b>Founded in 2018, OSS Capital is the first and only venture capital platform focused<br>exclusively on supporting early-stage COSS (commercial open source) startup founders.</b></sup>
|
|
53
|
+
</div>
|
|
54
|
+
</a>
|
|
35
55
|
</p>
|
|
36
56
|
</div>
|
|
37
57
|
|
|
@@ -45,7 +65,9 @@
|
|
|
45
65
|
$ npm install query-string
|
|
46
66
|
```
|
|
47
67
|
|
|
48
|
-
|
|
68
|
+
**Not `npm install querystring`!!!!!**
|
|
69
|
+
|
|
70
|
+
This module targets Node.js 6 or later and the latest version of Chrome, Firefox, and Safari.
|
|
49
71
|
|
|
50
72
|
## Usage
|
|
51
73
|
|
|
@@ -598,6 +620,12 @@ queryString.stringify({foo: undefined});
|
|
|
598
620
|
//=> ''
|
|
599
621
|
```
|
|
600
622
|
|
|
623
|
+
## FAQ
|
|
624
|
+
|
|
625
|
+
### Why is it parsing `+` as a space?
|
|
626
|
+
|
|
627
|
+
See [this answer](https://github.com/sindresorhus/query-string/issues/305).
|
|
628
|
+
|
|
601
629
|
## query-string for enterprise
|
|
602
630
|
|
|
603
631
|
Available as part of the Tidelift Subscription.
|