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

Function stripTomlComment

src/ops/lifecycle.js:178–208  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

176}
177
178function stripTomlComment(line) {
179 var out = '';
180 var quote = null;
181 var escaped = false;
182 for (var i = 0; i < String(line || '').length; i++) {
183 var ch = line[i];
184 if (escaped) {
185 out += ch;
186 escaped = false;
187 continue;
188 }
189 if (ch === '\\' && quote === '"') {
190 out += ch;
191 escaped = true;
192 continue;
193 }
194 if ((ch === '"' || ch === "'") && !quote) {
195 quote = ch;
196 out += ch;
197 continue;
198 }
199 if (ch === quote) {
200 quote = null;
201 out += ch;
202 continue;
203 }
204 if (ch === '#' && !quote) break;
205 out += ch;
206 }
207 return out.trim();
208}
209
210function readTomlStringValue(value) {
211 var raw = stripTomlComment(value);

Callers 2

readTomlStringValueFunction · 0.85
codexConfigExpectsProxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected