Add docstring to getMediaFromDirectory
parent
b3d42a3677
commit
8cdfb92e12
5
index.js
5
index.js
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue