diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-04-23 17:10:16 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-04-23 17:10:16 +0200 |
commit | e1fa977b5b1b3c03790de6e2c21ee39ba55d9555 (patch) | |
tree | a1ad4386100b5779ef930845093c14639a3353b5 /lib/json/encodeSummaryPart.js | |
parent | ce95f316b9ce1eac1e615db3540c4d0f30408d63 (diff) | |
download | gitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.zip gitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.tar.gz gitbook-e1fa977b5b1b3c03790de6e2c21ee39ba55d9555.tar.bz2 |
Add json encoding utils
Diffstat (limited to 'lib/json/encodeSummaryPart.js')
-rw-r--r-- | lib/json/encodeSummaryPart.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/json/encodeSummaryPart.js b/lib/json/encodeSummaryPart.js new file mode 100644 index 0000000..a5e7218 --- /dev/null +++ b/lib/json/encodeSummaryPart.js @@ -0,0 +1,17 @@ +var encodeSummaryArticle = require('./encodeSummaryArticle'); + +/** + Encode a SummaryPart to JSON + + @param {SummaryPart} + @return {Object} +*/ +function encodeSummaryPart(part) { + return { + title: part.getTitle(), + articles: part.getArticles() + .map(encodeSummaryArticle).toJS() + }; +} + +module.exports = encodeSummaryPart; |