(item, collection)
| 256 | ) |
| 257 | |
| 258 | async function addToCollection(item, collection) { |
| 259 | if (!item.page) return |
| 260 | collection.push(item.page) |
| 261 | |
| 262 | if (!item.childPages) return |
| 263 | await Promise.all( |
| 264 | item.childPages.map(async (childPage) => await addToCollection(childPage, collection)) |
| 265 | ) |
| 266 | } |
| 267 | |
| 268 | return pageList |
| 269 | } |