MCPcopy Index your code
hub / github.com/pomber/code-surfer / parseMetastring

Function parseMetastring

packs/code-surfer/src/codeblock-metastring-parser.ts:12–36  ·  view source on GitHub ↗
(metastring: string)

Source from the content-addressed store, hash-verified

10 * ```
11 */
12export function parseMetastring(metastring: string): ParsedMetastring {
13 if (!metastring) {
14 return {};
15 }
16
17 const argv = parse(metastring);
18 const result: ParsedMetastring = {};
19 argv.forEach(arg => {
20 if (!arg.includes("=")) {
21 if (arg === "showNumbers") {
22 result["showNumbers"] = true;
23 } else {
24 result.focus = arg;
25 }
26 } else {
27 const [key, value] = arg.split(/=(.*)/);
28 if (value === "true") {
29 result[key] = true;
30 } else {
31 result[key] = value;
32 }
33 }
34 });
35 return result;
36}

Callers 2

readStepFromElementFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected