From 0d94c2e58911a23ab7a37abb048065238666d82c Mon Sep 17 00:00:00 2001 From: siiky Date: Fri, 28 Jun 2024 15:43:17 +0100 Subject: [PATCH] refactor: destruct in parameters list --- lib/ofac/update.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ofac/update.js b/lib/ofac/update.js index 83e9b7a4..39738853 100644 --- a/lib/ofac/update.js +++ b/lib/ofac/update.js @@ -56,13 +56,12 @@ const promiseGetEtag = ({ url }) => request.end() }) -const download = _.curry((dstDir, source) => { - const {name, url: sourceUrl} = source +const download = _.curry((dstDir, { name, url }) => { const dstFile = path.join(dstDir, name + '.xml') const file = fs.createWriteStream(dstFile) return new Promise((resolve, reject) => { - const request = https.get(sourceUrl, response => { + const request = https.get(url, response => { response.pipe(file) file.on('finish', () => file.close(() => resolve(dstFile))) })