Skip to content

Commit

Permalink
fix: linting (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Aug 16, 2022
1 parent 71047db commit c8ef004
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ function cleanupOnExit (tmpfile) {
return () => {
try {
fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile)
} catch (_) {}
} catch {
// ignore errors
}
}
}

Expand Down Expand Up @@ -156,15 +158,20 @@ async function writeFileAsync (filename, data, options = {}) {
}
}

function writeFile (filename, data, options, callback) {
async function writeFile (filename, data, options, callback) {
if (options instanceof Function) {
callback = options
options = {}
}

const promise = writeFileAsync(filename, data, options)
if (callback) {
promise.then(callback, callback)
try {
const result = await promise
return callback(result)
} catch (err) {
return callback(err)
}
}

return promise
Expand Down

0 comments on commit c8ef004

Please sign in to comment.