Last active
October 24, 2018 13:48
-
-
Save SaraVieira/a820bc05e629d86ef194dadc21313a8d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 path = require("path"); | |
const imageExtensions = require("image-extensions"); | |
const isImage = value => { | |
if (typeof value !== "string") return null; | |
const extension = path.extname(value).slice(1); | |
if (imageExtensions.includes(extension)) return value; | |
return null | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment