const span = (name, content) =>
`${content}`;
const li = (...content) => `
${content.join('')}`;
const ul = (initial, content) =>
``;
const a = (index, text, ...content) =>
`${content.join(
''
)}`;
const createContent = (headings, page, initial) =>
ul(
initial,
headings.map(({ text, index, children, page }) =>
li(
text
? a(index, text, span('index', index), ' ', text, span('page', page))
: '',
children ? createContent(children, page) : ''
)
)
);
const contentlist = (headings, page) =>
//'Content
' +
createContent(headings, page, true);
export default contentlist;