mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
7543f354fb
simple iterable paths GitOrigin-RevId: f6906016888ccfc95c88858bdac4d2633fc1c5f4
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,
|
|
}
|