1 | const async = require('async');
|
2 | const Page = require('../models/Page');
|
3 |
|
4 | module.exports = (section, meta, callback) => {
|
5 |
|
6 | // Create a page for the top level page
|
7 | var sectionObj = new Page(section, meta);
|
8 |
|
9 | // Add any child pages
|
10 | if (section.subSections) {
|
11 | sectionObj.children = [];
|
12 |
|
13 | section.subSections.forEach((subSection) => {
|
14 | sectionObj.children.push(new Page(subSection, meta, sectionObj.key));
|
15 | });
|
16 | }
|
17 |
|
18 | callback(null, sectionObj);
|
19 | } |
\ | No newline at end of file |