MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / parsePluginArgs

Function parsePluginArgs

lib/utils/pluginParser.js:23–40  ·  view source on GitHub ↗
(args = [])

Source from the content-addressed store, hash-verified

21 * → { show: true }
22 */
23export function parsePluginArgs(args = []) {
24 const opts = {}
25 for (const arg of args) {
26 if (!arg) continue
27 for (const segment of arg.split(';')) {
28 if (!segment) continue
29 if (segment.includes('=')) {
30 const eq = segment.indexOf('=')
31 const key = segment.slice(0, eq)
32 const value = segment.slice(eq + 1)
33 opts[key] = coerce(value)
34 } else {
35 opts[segment] = true
36 }
37 }
38 }
39 return opts
40}
41
42function coerce(v) {
43 if (v === 'true') return true

Callers 5

aiTrace.jsFile · 0.90
screenshot.jsFile · 0.90
pause.jsFile · 0.90
heal.jsFile · 0.90
screencast.jsFile · 0.90

Calls 2

coerceFunction · 0.85
includesMethod · 0.80

Tested by

no test coverage detected