restructure overlay

This commit is contained in:
Lachlan Kermode
2019-02-13 16:13:54 +00:00
parent b1e47ed2eb
commit 1db2fe219a
9 changed files with 194 additions and 223 deletions

View File

@@ -136,3 +136,18 @@ export function toggleFlagAC (flag) {
}
})
}
export function selectTypeFromPath (path) {
let type
switch (true) {
case /\.(png|jpg)$/.test(path):
type = 'Image'; break
case /\.(mp4)$/.test(path):
type = 'Video'; break
case /\.(md)$/.test(path):
type = 'Text'; break
default:
type = 'Unknown'; break
}
return { type, path }
}