MCPcopy Index your code
hub / github.com/Doorman11991/smallcode / stripInlineComment

Function stripInlineComment

bin/config.js:87–97  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

85}
86
87function stripInlineComment(value) {
88 let quote = null;
89 for (let i = 0; i < value.length; i++) {
90 const ch = value[i];
91 if ((ch === '"' || ch === "'") && value[i - 1] !== '\\') {
92 quote = quote === ch ? null : (quote || ch);
93 }
94 if (ch === '#' && !quote) return value.slice(0, i).trim();
95 }
96 return value.trim();
97}
98
99function parseTomlValue(raw) {
100 const value = stripInlineComment(raw);

Callers 1

parseTomlValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected