MCPcopy Create free account
hub / github.com/chhoumann/quickadd / skipWhitespaceAndComments

Function skipWhitespaceAndComments

src/utils/userScriptSecrets.ts:132–159  ·  view source on GitHub ↗
(source: string, index: number)

Source from the content-addressed store, hash-verified

130}
131
132function skipWhitespaceAndComments(source: string, index: number): number {
133 let current = index;
134 while (current < source.length) {
135 const char = source[current];
136 const next = source[current + 1];
137
138 if (/\s/.test(char)) {
139 current += 1;
140 continue;
141 }
142
143 if (char === "/" && next === "/") {
144 const newline = source.indexOf("\n", current + 2);
145 current = newline === -1 ? source.length : newline + 1;
146 continue;
147 }
148
149 if (char === "/" && next === "*") {
150 const end = source.indexOf("*/", current + 2);
151 current = end === -1 ? source.length : end + 2;
152 continue;
153 }
154
155 return current;
156 }
157
158 return current;
159}
160
161function readStringLiteral(
162 source: string,

Callers 4

findOptionsObjectSpansFunction · 0.85
readOptionKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected