mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
22 lines
489 B
JavaScript
22 lines
489 B
JavaScript
|
|
/**
|
|
Encode a SummaryArticle to JSON
|
|
|
|
@param {SummaryArticle}
|
|
@return {Object}
|
|
*/
|
|
function encodeSummaryArticle(article) {
|
|
return {
|
|
title: article.getTitle(),
|
|
level: article.getLevel(),
|
|
depth: article.getDepth(),
|
|
anchor: article.getAnchor(),
|
|
url: article.getUrl(),
|
|
path: article.getPath(),
|
|
articles: article.getArticles()
|
|
.map(encodeSummaryArticle).toJS()
|
|
};
|
|
}
|
|
|
|
module.exports = encodeSummaryArticle;
|