diff options
Diffstat (limited to 'lib/json')
-rw-r--r-- | lib/json/encodeOutput.js | 22 | ||||
-rw-r--r-- | lib/json/index.js | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/json/encodeOutput.js b/lib/json/encodeOutput.js new file mode 100644 index 0000000..bb53a62 --- /dev/null +++ b/lib/json/encodeOutput.js @@ -0,0 +1,22 @@ +var encodeBook = require('./encodeBook'); + +/** + Encode an output to JSON + + @param {Output} + @return {Object} +*/ +function encodeOutputToJson(output) { + var book = output.getBook(); + var generator = output.getGenerator(); + + var result = encodeBook(book); + + result.output = { + name: generator + }; + + return result; +} + +module.exports = encodeOutputToJson; diff --git a/lib/json/index.js b/lib/json/index.js index e58beee..39cac99 100644 --- a/lib/json/index.js +++ b/lib/json/index.js @@ -1,5 +1,6 @@ module.exports = { + encodeOutput: require('./encodeOutput'), encodeBookWithPage: require('./encodeBookWithPage'), encodeBook: require('./encodeBook'), encodeFile: require('./encodeFile'), |