Check file extension name
$ yarn add is-extname
const isExtname = require('is-extname')
const create = async file => {
const extname = isExtname(file, 'json')
if (extname) {
return await create()
}
return new TypeError(`We don't support this type of file.`)
}
MIT © Bu Kinoshita