1
1
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:
divlo
2021-02-18 19:40:44 +01:00
parent 08e468535a
commit 7aa12f313e
11 changed files with 365 additions and 39 deletions

View File

@ -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)
}