mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
16 lines
304 B
JavaScript
16 lines
304 B
JavaScript
|
/**
|
||
|
* Handles malformed filetrees - when fields such as `folder.docs`,
|
||
|
* `folder.folders` or `folder.fileRefs` are missing it returns an
|
||
|
* empty array.
|
||
|
*/
|
||
|
function iterablePaths(folder, field) {
|
||
|
if (!folder) {
|
||
|
return []
|
||
|
}
|
||
|
return folder[field] || []
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
iterablePaths,
|
||
|
}
|