mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
19 lines
388 B
JavaScript
19 lines
388 B
JavaScript
|
|
/**
|
|
Encode a SummaryArticle to JSON
|
|
|
|
@param {SummaryArticle}
|
|
@return {Object}
|
|
*/
|
|
function encodeSummaryArticle(article) {
|
|
return {
|
|
title: article.getTitle(),
|
|
level: article.getLevel(),
|
|
depth: article.getDepth(),
|
|
articles: article.getArticles()
|
|
.map(encodeSummaryArticle).toJS()
|
|
};
|
|
}
|
|
|
|
module.exports = encodeSummaryArticle;
|