query-string 2.4.1 → 2.4.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/index.js +4 -2
- package/package.json +3 -3
- package/readme.md +3 -3
package/index.js
CHANGED
|
@@ -18,8 +18,10 @@ exports.parse = function (str) {
|
|
|
18
18
|
|
|
19
19
|
return str.split('&').reduce(function (ret, param) {
|
|
20
20
|
var parts = param.replace(/\+/g, ' ').split('=');
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// Firefox (pre 40) decodes `%3D` to `=`
|
|
22
|
+
// https://github.com/sindresorhus/query-string/pull/37
|
|
23
|
+
var key = parts.shift();
|
|
24
|
+
var val = parts.length > 0 ? parts.join('=') : undefined;
|
|
23
25
|
|
|
24
26
|
key = decodeURIComponent(key);
|
|
25
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "query-string",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Parse and stringify URL query strings",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "sindresorhus/query-string",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"node": ">=0.10.0"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "xo &&
|
|
16
|
+
"test": "xo && ava"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"strict-uri-encode": "^1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"
|
|
40
|
+
"ava": "*",
|
|
41
41
|
"xo": "*"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/readme.md
CHANGED
|
@@ -13,19 +13,19 @@ $ npm install --save query-string
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```js
|
|
16
|
-
|
|
16
|
+
const queryString = require('query-string');
|
|
17
17
|
|
|
18
18
|
console.log(location.search);
|
|
19
19
|
//=> '?foo=bar'
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const parsed = queryString.parse(location.search);
|
|
22
22
|
console.log(parsed);
|
|
23
23
|
//=> {foo: 'bar'}
|
|
24
24
|
|
|
25
25
|
console.log(location.hash);
|
|
26
26
|
//=> '#token=bada55cafe'
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const parsedHash = queryString.parse(location.hash);
|
|
29
29
|
console.log(parsedHash);
|
|
30
30
|
//=> {token: 'bada55cafe'}
|
|
31
31
|
|