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

Function formatLoonArgumentValue

Rewrite-Parser.beta.js:2119–2126  ·  view source on GitHub ↗
(item, type = item.type, isRuleToggle = false)

Source from the content-addressed store, hash-verified

2117}
2118
2119function formatLoonArgumentValue(item, type = item.type, isRuleToggle = false) {
2120 const value = `${item.value ?? ''}`.trim()
2121 if (type == 'switch') {
2122 const switchDefault = isRuleToggle ? getToggleSwitchDefault(value) : getSwitchDefault(value)
2123 return switchDefault == 'true' ? 'true,false' : 'false,true'
2124 }
2125 return quoteLoonInputValue(value)
2126}
2127
2128function isLoonArgumentList(str) {
2129 return /^\s*\[(?:\s*\{[^{}]+\}\s*,?)+\]\s*$/.test(stripWrapQuote(str))

Callers 1

Calls 3

getToggleSwitchDefaultFunction · 0.85
getSwitchDefaultFunction · 0.85
quoteLoonInputValueFunction · 0.85

Tested by

no test coverage detected