Created
May 23, 2018 21:18
-
-
Save Anderson-Juhasc/4984e099a9f0bf38f0df4792d888df60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isImage = (name, msg, req) => { | |
let proof = typeof req.files[name] !== "undefined" ? req.files[name] : undefined; | |
if (!proof) { | |
throw new Error(msg) | |
} | |
switch (proof.type) { | |
case 'image/jpeg': | |
return 'image/jpeg'; | |
case 'image/png': | |
return 'image/png'; | |
default: | |
throw new Error('Documento de identificação precisa ser um arquivo .jpeg ou .png.'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment