MCPcopy Create free account
hub / github.com/EvoMap/evolver / _stripTomlComment

Function _stripTomlComment

src/adapters/scripts/evolver-session-start.js:38–67  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

36}
37
38function _stripTomlComment(line) {
39 let out = '';
40 let quote = null;
41 let escaped = false;
42 for (const ch of String(line || '')) {
43 if (escaped) {
44 out += ch;
45 escaped = false;
46 continue;
47 }
48 if (ch === '\\' && quote === '"') {
49 out += ch;
50 escaped = true;
51 continue;
52 }
53 if ((ch === '"' || ch === "'") && !quote) {
54 quote = ch;
55 out += ch;
56 continue;
57 }
58 if (ch === quote) {
59 quote = null;
60 out += ch;
61 continue;
62 }
63 if (ch === '#' && !quote) break;
64 out += ch;
65 }
66 return out.trim();
67}
68
69function _tomlStringValue(value) {
70 const raw = _stripTomlComment(value);

Callers 2

_tomlStringValueFunction · 0.85
_codexConfigExpectsProxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected