We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0589a40 commit 0d38e5dCopy full SHA for 0d38e5d
src/Support/Helpers/updateLine.imba
@@ -1,13 +1,15 @@
1
-import { promises as fs } from 'fs'
+import { existsSync } from 'fs'
2
+import { readFileSync } from 'fs'
3
+import { writeFileSync } from 'fs'
4
-export default def updateLine file\string, callback\function
5
+export def updateLine file\string, callback\function
6
if !existsSync(file) then return false
7
- const contents = fs.readFileSync(file, 'utf8')
8
+ const contents = readFileSync(file, 'utf8')
9
const lines = []
10
const splitLines = contents.split('\n')
11
for index in [0...splitLines.length]
12
lines.push callback(splitLines[index], index)
13
- fs.writeFileSync(file, lines.join('\n'), { encoding: 'utf8' })
14
+ writeFileSync(file, lines.join('\n'), { encoding: 'utf8' })
15
return true
0 commit comments