At first I was concerned due to a particular ESLint rule called "no-undefined", but then after looking more deeply into it, I realized using typeof was unnecessary since "no-global-assign" and "no-shadow-restricted-names" were enabled and thus the previous method surely would not cause any problems.
This commit is contained in:
Bobby Wibowo 2018-01-24 19:53:31 +07:00
parent 7de25210ce
commit 5052cd2651
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
1 changed files with 1 additions and 1 deletions

View File

@ -98,7 +98,7 @@ uploadsController.actuallyUpload = async (req, res, userid, album) => {
hash: fileHash, hash: fileHash,
ip: req.ip, ip: req.ip,
albumid: album, albumid: album,
userid: typeof userid !== 'undefined' ? userid.id : null, userid: userid !== undefined ? userid.id : null,
timestamp: Math.floor(Date.now() / 1000) timestamp: Math.floor(Date.now() / 1000)
}); });
} else { } else {