MCPcopy Create free account
hub / github.com/AztecProtocol/aztec-packages / processLine

Function processLine

docs/src/preprocess/include_code.js:30–46  ·  view source on GitHub ↗
(line, regex, replacement)

Source from the content-addressed store, hash-verified

28 let mutated = false;
29
30 const processLine = (line, regex, replacement) => {
31 const match = line.match(regex);
32 if (match) {
33 mutated = true;
34
35 const identifiers = match[1].split(":");
36 if (identifiers.includes(identifier)) {
37 line = line.replace(match[0], replacement);
38 } else {
39 // Remove matched text completely
40 line = line.replace(match[0], "");
41 }
42 } else {
43 // No match: it's an ordinary line of code.
44 }
45 return line.trim() == "//" || line.trim() == "#" ? "" : line;
46 };
47
48 const countLeadingSpaces = (line) => {
49 const match = line.match(/^ */);

Callers 1

processHighlightingFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected