MCPcopy
hub / github.com/QwikDev/qwik / breakLongLine

Function breakLongLine

scripts/docs_sync/main.ts:135–158  ·  view source on GitHub ↗
(longLine: string)

Source from the content-addressed store, hash-verified

133const LINE_WIDTH = 95;
134
135function breakLongLine(longLine: string): string[] {
136 if (longLine.length < LINE_WIDTH) return [longLine];
137 const output: string[] = [];
138 while (longLine) {
139 if (longLine.length < LINE_WIDTH) {
140 output.push(longLine);
141 break;
142 }
143 let index = 0;
144 let lastWhitespace = index;
145 while (index < longLine.length && index < LINE_WIDTH) {
146 if (longLine[index++].match(/\s/)) {
147 lastWhitespace = index;
148 }
149 }
150 if (lastWhitespace == 0) {
151 output.push(longLine);
152 break;
153 }
154 output.push(longLine.slice(0, lastWhitespace - 1));
155 longLine = longLine.slice(lastWhitespace).trim();
156 }
157 return output;
158}

Callers 1

scanForDocDirectiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…