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

Function parseQueryString

script-converter.js:553–566  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

551}
552// 参数 与其他脚本逻辑一致
553function parseQueryString(url) {
554 const queryString = url.split('?')[1] // 获取查询字符串部分
555 const regex = /([^=&]+)=([^&]*)/g // 匹配键值对的正则表达式
556 const params = {}
557 let match
558
559 while ((match = regex.exec(queryString))) {
560 const key = decodeURIComponent(match[1]) // 解码键
561 const value = decodeURIComponent(match[2]) // 解码值
562 params[key] = value // 将键值对添加到对象中
563 }
564
565 return params
566}
567// 是否为真 与其他脚本逻辑一致
568function istrue(str) {
569 if (str == true || str == 1 || str == 'true' || str == '1') {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected