Add docstring to getMediaFromDirectory

pull/3/head
Brogan Clements 2021-12-03 15:08:05 -05:00
parent b3d42a3677
commit 8cdfb92e12
1 changed files with 5 additions and 0 deletions

View File

@ -159,6 +159,11 @@ function getFilesFromDir(dir) {
.map((file) => path.join(dir, file)); .map((file) => path.join(dir, file));
} }
/**
* Retrieves the folder name from a string representing a directory and file
* @param {String} dir A string representing a directory in the format "./directory/file"
* @returns {String} The extracted directory name
*/
function getMediaFromDirectory(dir) { function getMediaFromDirectory(dir) {
const slash = dir.lastIndexOf("/"); const slash = dir.lastIndexOf("/");
let mediaType = dir.slice(2, slash); let mediaType = dir.slice(2, slash);