Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const rows = entries.map(entry => {
const ext = path.extname(entry.name);
// Maintain path sep, but deal with things like spaces in filenames
const href = encodeURI(`${route}${path.join(dirPath, entry.name)}`);
let icon;
let alt;
// TODO: switch this to entry.isDirectory() if possible
if (entry.type === 'DIRECTORY') {
icon = folder;
alt = '[DIR]';
} else {
if (isImage(ext)) {
icon = image2;
alt = '[IMG]';
} else if (isMedia(ext)) {
icon = movie;
alt = '[MOV]';