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

Function parseQueryString

rule-parser.js:398–411  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

396}
397
398function parseQueryString(url) {
399 const queryString = url.split('?')[1] // 获取查询字符串部分
400 const regex = /([^=&]+)=([^&]*)/g // 匹配键值对的正则表达式
401 const params = {}
402 let match
403
404 while ((match = regex.exec(queryString))) {
405 const key = decodeURIComponent(match[1]) // 解码键
406 const value = decodeURIComponent(match[2]) // 解码值
407 params[key] = value // 将键值对添加到对象中
408 }
409
410 return params
411}
412
413// 请求
414async function http(url, opts = {}) {

Callers 1

rule-parser.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected