summaryrefslogtreecommitdiffstats
path: root/lib/api/encodeSummary.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
committerSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
commita14ca3e268e95a7eab59fb205b41da7331d57631 (patch)
tree9c84b2cbd561345335fca3e26af961b2ea23d8ec /lib/api/encodeSummary.js
parent9c071dade573aa6990878006f83c89b6065a1395 (diff)
downloadgitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.zip
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.gz
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.bz2
Switch to lerna
Diffstat (limited to 'lib/api/encodeSummary.js')
-rw-r--r--lib/api/encodeSummary.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/lib/api/encodeSummary.js b/lib/api/encodeSummary.js
deleted file mode 100644
index 0d66ded..0000000
--- a/lib/api/encodeSummary.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var encodeSummaryArticle = require('../json/encodeSummaryArticle');
-
-/**
- Encode summary to provide an API to plugin
-
- @param {Output} output
- @param {Config} config
- @return {Object}
-*/
-function encodeSummary(output, summary) {
- var result = {
- /**
- Iterate over the summary, it stops when the "iter" returns false
-
- @param {Function} iter
- */
- walk: function (iter) {
- summary.getArticle(function(article) {
- var jsonArticle = encodeSummaryArticle(article, false);
-
- return iter(jsonArticle);
- });
- },
-
- /**
- Get an article by its level
-
- @param {String} level
- @return {Object}
- */
- getArticleByLevel: function(level) {
- var article = summary.getByLevel(level);
- return (article? encodeSummaryArticle(article) : undefined);
- },
-
- /**
- Get an article by its path
-
- @param {String} level
- @return {Object}
- */
- getArticleByPath: function(level) {
- var article = summary.getByPath(level);
- return (article? encodeSummaryArticle(article) : undefined);
- }
- };
-
- return result;
-}
-
-module.exports = encodeSummary;