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

Function parseLoonValue

Rewrite-Parser.js:3190–3203  ·  view source on GitHub ↗
(_v)

Source from the content-addressed store, hash-verified

3188// "a" 是 "a"
3189// 由于在解析配置是用空格分割各个参数,如果配置的参数中有空格,请使用\x20代替
3190function parseLoonValue(_v) {
3191 let v = _v.replace(/\\x20/g, ' ')
3192 if (/^".*"$/.test(v)) {
3193 // 双引号包裹的肯定是字符串
3194 v = v.replace(/^"(.*?)"$/, '$1')
3195 } else {
3196 try {
3197 v = JSON.parse(v)
3198 } catch (e) {
3199 console.log(`解析 Loon 值 ${v} 失败: ${e}`)
3200 }
3201 }
3202 return v
3203}
3204function done(...args) {
3205 $.log(`⏱ 总耗时:${Math.round(((Date.now() - script_start) / 1000) * 100) / 100} 秒`)
3206 $.done(...args)

Callers 1

Rewrite-Parser.jsFile · 0.70

Calls 2

parseMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected