MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / parseQueryString

Function parseQueryString

Rewrite-Parser.js:2429–2442  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

2427}
2428
2429function parseQueryString(url) {
2430 const queryString = url.split('?')[1] //获取查询字符串部分
2431 const regex = /([^=&]+)=([^&]*)/g //匹配键值对的正则表达式
2432 const params = {}
2433 let match
2434
2435 while ((match = regex.exec(queryString))) {
2436 const key = decodeURIComponent(match[1]) //解码键
2437 const value = decodeURIComponent(match[2]) //解码值
2438 params[key] = value //将键值对添加到对象中
2439 }
2440
2441 return params
2442}
2443// 请求
2444async function http(url, opts = {}) {
2445 const http_start = Date.now()

Callers 1

Rewrite-Parser.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected