MCPcopy
hub / github.com/kriasoft/graphql-starter-kit / replace

Function replace

scripts/setup.js:23–32  ·  view source on GitHub ↗
(filename, searchValue, replaceValue)

Source from the content-addressed store, hash-verified

21};
22
23function replace(filename, searchValue, replaceValue) {
24 let text = fs.readFileSync(filename, "utf8");
25 if (text.match(searchValue)) {
26 text = text.replace(searchValue, replaceValue);
27 fs.writeFileSync(filename, text, "utf8");
28 return true;
29 } else {
30 return `Failed to find ${searchValue} in ${filename}`;
31 }
32}
33
34const questions = [
35 {

Callers 1

validateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected