MCPcopy Create free account
hub / github.com/Ice-Hazymoon/MikuTools / getQueryStringArgs

Function getQueryStringArgs

utils/formatUrl.js:1–23  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

1function getQueryStringArgs(url) {
2 if (url && url.indexOf('?') > -1) {
3 var arr = url.split('?');
4 var qs = arr[1],
5 args = {},
6 items = qs.length ? qs.split('&') : [],
7 item = null,
8 name = null,
9 value = null,
10 i = 0,
11 len = items.length;
12 for (i = 0; i < len; i++) {
13 item = items[i].split('=');
14 name = decodeURIComponent(item[0]);
15 value = decodeURIComponent(item[1]);
16 if (name.length) {
17 args[name] = value;
18 }
19 }
20 return args;
21 }
22 return {};
23}
24
25export default getQueryStringArgs;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected