MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / findCodeFromString

Function findCodeFromString

web/src/lib/attachments/pdfjsBuildOutput.ts:34–41  ·  view source on GitHub ↗
(file: string, text: string)

Source from the content-addressed store, hash-verified

32}
33
34export function findCodeFromString(file: string, text: string): Hit[] {
35 const hits: Hit[] = [];
36 for (const m of text.matchAll(CODE_FROM_STRING)) {
37 const at = m.index ?? 0;
38 hits.push({ file, index: at, excerpt: text.slice(Math.max(0, at - 30), at + 50) });
39 }
40 return hits;
41}
42
43/** Every file under `dir`, recursively, with a path relative to `dir`. */
44export function walk(dir: string, rel = ''): string[] {

Callers 1

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected