MCPcopy Index your code
hub / github.com/epicweb-dev/advanced-react-patterns / writeIfNeeded

Function writeIfNeeded

epicshop/fix.js:93–99  ·  view source on GitHub ↗
(filepath, content)

Source from the content-addressed store, hash-verified

91}
92
93async function writeIfNeeded(filepath, content) {
94 const oldContent = await fs.promises.readFile(filepath, 'utf8')
95 if (oldContent !== content) {
96 await fs.promises.writeFile(filepath, content)
97 }
98 return oldContent !== content
99}
100
101function exists(p) {
102 if (!p) return false

Callers 2

updatePkgNamesFunction · 0.85
updateTsconfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected