Skip to content

Commit a561e3e

Browse files
author
John Doherty
committed
Modified constructor to return a promise
1 parent 1e86589 commit a561e3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/jsdoc-to-json-schema.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ module.exports = function(input, output) {
99
output = output || process.stdout; // default stdout
1010

1111
// get input as a stream
12-
getInputAsStream(input).then(function(inputStream) {
12+
return getInputAsStream(input).then(function(inputStream) {
1313

1414
var parser = jsDocParse();
1515

1616
// send input into jsdoc-parser
1717
inputStream.pipe(parser);
1818

1919
// read jsdoc-parse output as json string
20-
stream2string(parser).then(function(comments) {
20+
return stream2string(parser).then(function(comments) {
2121

2222
// convert json string into JSON array of comments
2323
var jsonComments = JSON.parse(comments);
@@ -41,6 +41,9 @@ module.exports = function(input, output) {
4141
});
4242
}
4343

44+
// if no output object, return promise with JSON object
45+
return Promise.resolve(jsonSchema);
46+
4447
});
4548
});
4649
};

0 commit comments

Comments
 (0)