From ee1538eed957f4bb962e3830e42ff7c7edfaa0b6 Mon Sep 17 00:00:00 2001 From: BoHong Li Date: Fri, 2 Aug 2019 01:00:46 +0800 Subject: [PATCH] refactor: fix lint on lib/web/userRouter.js Signed-off-by: BoHong Li --- lib/web/userRouter.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/web/userRouter.js b/lib/web/userRouter.js index 9860e0bf..83a32cb4 100644 --- a/lib/web/userRouter.js +++ b/lib/web/userRouter.js @@ -69,8 +69,7 @@ UserRouter.get('/me/delete/:token?', function (req, res) { // export the data of the authenticated user UserRouter.get('/me/export', function (req, res) { if (req.isAuthenticated()) { - // let output = fs.createWriteStream(__dirname + '/example.zip'); - let archive = archiver('zip', { + const archive = archiver('zip', { zlib: { level: 3 } // Sets the compression level. }) res.setHeader('Content-Type', 'application/zip') @@ -90,14 +89,14 @@ UserRouter.get('/me/export', function (req, res) { ownerId: user.id } }).then(function (notes) { - let filenames = {} + const filenames = {} async.each(notes, function (note, callback) { let basename = note.title.replace(/\//g, '-') // Prevent subdirectories let filename - let suffix = '' + let suffix = 0 do { - let seperator = typeof suffix === 'number' ? '-' : '' - filename = basename + seperator + suffix + '.md' + const separator = suffix === 0 ? '' : '-' + filename = basename + separator + suffix + '.md' suffix++ } while (filenames[filename]) filenames[filename] = true