MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / dedent

Function dedent

scripts/generate-doc-snippets.ts:20–33  ·  view source on GitHub ↗
(lines: readonly string[])

Source from the content-addressed store, hash-verified

18const markerPattern = /^\s*\/\/ docs:(start|end) ([a-z0-9-]+)\s*$/;
19
20const dedent = (lines: readonly string[]): string => {
21 const nonBlank = lines.filter((line) => line.trim().length > 0);
22 const indent = Math.min(
23 ...nonBlank.map((line) => {
24 const match = line.match(/^\s*/);
25 return match?.[0].length ?? 0;
26 }),
27 );
28
29 return lines
30 .map((line) => line.slice(indent))
31 .join("\n")
32 .trim();
33};
34
35for (const source of sources) {
36 const text = await Bun.file(source.source).text();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected