Comparing version 1.0.2 to 1.0.3
@@ -27,12 +27,12 @@ 'use strict'; | ||
_this.options.files = arrayify(_this.options.files); | ||
_this.on('pipe', function (src) { | ||
_this._writeCollector = collectAll(function (source) { | ||
if (!(_this.inProgress || _this.options.files.length || _this.options.source)) { | ||
src.pipe(collectAll(function (source) { | ||
_this.options.source = source; | ||
_this.start(); | ||
_this.inProgress = true; | ||
})); | ||
_this.options.source = source; | ||
_this.start(); | ||
_this.inProgress = true; | ||
} | ||
}); | ||
_this.on('finish', function () { | ||
_this._writeCollector.end(); | ||
}); | ||
return _this; | ||
@@ -66,2 +66,3 @@ } | ||
value: function _write(chunk, encoding, done) { | ||
this._writeCollector.write(chunk); | ||
done(); | ||
@@ -68,0 +69,0 @@ } |
@@ -13,12 +13,12 @@ 'use strict' | ||
this.options.files = arrayify(this.options.files) | ||
this.on('pipe', src => { | ||
this._writeCollector = collectAll(source => { | ||
if (!(this.inProgress || this.options.files.length || this.options.source)) { | ||
src.pipe(collectAll(source => { | ||
this.options.source = source | ||
this.start() | ||
this.inProgress = true | ||
})) | ||
this.options.source = source | ||
this.start() | ||
this.inProgress = true | ||
} | ||
}) | ||
this.on('finish', () => { | ||
this._writeCollector.end() | ||
}) | ||
} | ||
@@ -45,2 +45,3 @@ | ||
_write (chunk, encoding, done) { | ||
this._writeCollector.write(chunk) | ||
done() | ||
@@ -47,0 +48,0 @@ } |
@@ -6,3 +6,3 @@ 'use strict' | ||
/** | ||
* A programmatic interface for [jsdoc3](https://github.com/jsdoc3/jsdoc). It provides sync, async (Promise) and streaming interfaces for the two main jsdoc operations ('explain' and 'render documentation'). | ||
* A programmatic interface for [jsdoc3](https://github.com/jsdoc3/jsdoc). It provides sync, async (Promise) and streaming interfaces for the two main jsdoc operations ('explain' and 'render documentation'). You can input source code via a string, a set of file names or a stream. | ||
* | ||
@@ -9,0 +9,0 @@ * @module jsdoc-api |
{ | ||
"name": "jsdoc-api", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A programmatic interface for jsdoc", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/jsdoc2md/jsdoc-api.git", |
@@ -11,3 +11,3 @@ [![view on npm](http://img.shields.io/npm/v/jsdoc-api.svg)](https://www.npmjs.org/package/jsdoc-api) | ||
## jsdoc-api | ||
A programmatic interface for [jsdoc3](https://github.com/jsdoc3/jsdoc). It provides sync, async (Promise) and streaming interfaces for the two main jsdoc operations ('explain' and 'render documentation'). | ||
A programmatic interface for [jsdoc3](https://github.com/jsdoc3/jsdoc). It provides sync, async (Promise) and streaming interfaces for the two main jsdoc operations ('explain' and 'render documentation'). You can input source code via a string, a set of file names or a stream. | ||
@@ -14,0 +14,0 @@ **Example** |
@@ -27,3 +27,3 @@ var test = require('tape') | ||
test('.createExplainStream() stream input', function (t) { | ||
test('.createExplainStream() stream input - pipe', function (t) { | ||
t.plan(1) | ||
@@ -39,2 +39,15 @@ var f = new Fixture('global/class-all') | ||
test('.createExplainStream() stream input - write', function (t) { | ||
t.plan(1) | ||
var f = new Fixture('global/class-all') | ||
var explainStream = jsdoc.createExplainStream() | ||
explainStream.pipe(collectJson(function (output) { | ||
if (output) { | ||
var expectedOutput = f.getExpectedOutput(output) | ||
t.deepEqual(output, expectedOutput) | ||
} | ||
})) | ||
explainStream.end(f.getSource()) | ||
}) | ||
test('.createExplainStream: no valid files', function (t) { | ||
@@ -41,0 +54,0 @@ t.plan(1) |
@@ -19,3 +19,3 @@ var test = require('tape') | ||
test('.renderSync.source(source, options)', function (t) { | ||
test('.renderSync({ source, destination })', function (t) { | ||
Fixture.createTmpFolder('tmp') | ||
@@ -22,0 +22,0 @@ var f = new Fixture('global/class-all') |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1072113
1505