@lijuhong1981/jsurl 1.0.10 → 1.0.12
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 +2 -2
- package/package.json +2 -2
- package/src/{parseQuery.js → parseQueryParams.js} +3 -2
- package/src/parseUrl.js +2 -2
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import isHttpProtocol from "./src/isHttpProtocol.js";
|
|
|
11
11
|
import splitPath from "./src/splitPath.js";
|
|
12
12
|
import splitUrl from "./src/splitUrl.js";
|
|
13
13
|
import parsePath from "./src/parsePath.js";
|
|
14
|
-
import
|
|
14
|
+
import parseQueryParams from "./src/parseQueryParams.js";
|
|
15
15
|
import parseUrl from "./src/parseUrl.js";
|
|
16
16
|
|
|
17
17
|
export {
|
|
@@ -28,6 +28,6 @@ export {
|
|
|
28
28
|
splitPath,
|
|
29
29
|
splitUrl,
|
|
30
30
|
parsePath,
|
|
31
|
-
|
|
31
|
+
parseQueryParams,
|
|
32
32
|
parseUrl,
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lijuhong1981/jsurl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "lijuhong1981 <lijuhong@hotmail.com>",
|
|
6
6
|
"homepage": "https://github.com/lijuhong1981/jslibs#readme",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/lijuhong1981/jslibs/issues"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "48354c4b7f9b97b10ed4d592dfa0dbb839b5bbe6"
|
|
22
22
|
}
|
|
@@ -6,11 +6,12 @@ const queryPattern = /(?:^|&)([^&=]*)=?([^&]*)/g;
|
|
|
6
6
|
* @param {object} result
|
|
7
7
|
* @returns {object}
|
|
8
8
|
*/
|
|
9
|
-
function
|
|
9
|
+
function parseQueryParams(urlQuery, result = {}) {
|
|
10
10
|
urlQuery.replace(queryPattern, function (match, key, value) {
|
|
11
11
|
if (key)
|
|
12
12
|
result[key] = value;
|
|
13
13
|
});
|
|
14
|
+
return result;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
export default
|
|
17
|
+
export default parseQueryParams;
|
package/src/parseUrl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import splitUrl from "./splitUrl.js";
|
|
2
|
-
import
|
|
2
|
+
import parseQueryParams from "./parseQueryParams.js";
|
|
3
3
|
|
|
4
4
|
const names = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
|
|
5
5
|
|
|
@@ -37,7 +37,7 @@ function parseUrl(url, result = {}) {
|
|
|
37
37
|
}
|
|
38
38
|
result.queryParams = {};
|
|
39
39
|
if (result.query)
|
|
40
|
-
|
|
40
|
+
parseQueryParams(result.query, result.queryParams);
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
43
|
|