mirror of
https://github.com/theoludwig/programming-challenges.git
synced 2025-05-18 12:02:53 +02:00
feat: add Defibrillators challenge and TypeScript solution
This commit is contained in:
@ -8,12 +8,12 @@ const inputPath = path.join(__dirname, 'input.json')
|
||||
const outputPath = path.join(__dirname, 'output.json')
|
||||
|
||||
const main = async () => {
|
||||
const inputFile = await fs.readFile(inputPath)
|
||||
const inputFile = await fs.readFile(inputPath, { encoding: 'utf-8' })
|
||||
const inputJSON = JSON.parse(inputFile.toString())
|
||||
|
||||
try {
|
||||
const result = solution.apply(null, inputJSON)
|
||||
await fs.writeFile(outputPath, JSON.stringify(result))
|
||||
await fs.writeFile(outputPath, JSON.stringify(result), { encoding: 'utf-8' })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user