Socket
Socket
Sign inDemoInstall

jsdoc-api

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsdoc-api - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

15

es5/jsdoc-api.js

@@ -17,5 +17,7 @@ 'use strict';

var collectJson = require('collect-json');
var Readable = require('stream').Readable;
exports.explainSync = explainSync;
exports.explain = explain;
exports.createExplainStream = createExplainStream;
exports.renderSync = renderSync;

@@ -57,2 +59,15 @@

function createExplainStream(files) {
var stream = new Readable();
stream._read = function () {
var _this = this;
explain(files).then(function (output) {
_this.push(JSON.stringify(output, null, ' '));
_this.push(null);
});
};
return stream;
}
function renderSync(files, options) {

@@ -59,0 +74,0 @@ var args = toSpawnArgs(options).concat(arrayify(files));

@@ -12,5 +12,7 @@ 'use strict'

const collectJson = require('collect-json')
const Readable = require('stream').Readable
/**
* @module jsdoc-api
* @typicalname jsdoc
* @example

@@ -21,2 +23,3 @@ * const jsdoc = require('jsdoc-api')

exports.explain = explain
exports.createExplainStream = createExplainStream
exports.renderSync = renderSync

@@ -58,2 +61,3 @@

* @returns {Promise}
* @static
*/

@@ -73,2 +77,3 @@ function explain (files) {

* @returns {Promise}
* @static
*/

@@ -86,2 +91,19 @@ explain.source = function explainSource (source) {

function createExplainStream (files) {
const stream = new Readable()
stream._read = function () {
explain(files).then(output => {
this.push(JSON.stringify(output, null, ' '))
this.push(null)
})
}
return stream
}
/**
* @param {string|string[]} - input source files
* @param [options] {object} - options
* @param [options.destination] - destination path
* @static
*/
function renderSync (files, options) {

@@ -88,0 +110,0 @@ const args = toSpawnArgs(options).concat(arrayify(files))

2

package.json
{
"name": "jsdoc-api",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "0.1.0",
"version": "0.1.1",
"description": "A programmatic interface for jsdoc",

@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/jsdoc-api.git",

@@ -16,20 +16,61 @@ [![view on npm](http://img.shields.io/npm/v/jsdoc-api.svg)](https://www.npmjs.org/package/jsdoc-api)

* [jsdoc-api](#module_jsdoc-api)
* [.explain(source)](#module_jsdoc-api.explain) ⇒ <code>object</code>
* [.render(source, [options])](#module_jsdoc-api.render)
* [.explainSync(files)](#module_jsdoc-api.explainSync) ⇒ <code>object</code>
* [.source(source)](#module_jsdoc-api.explainSync.source) ⇒ <code>Array.&lt;object&gt;</code>
* [.explain(files)](#module_jsdoc-api.explain) ⇒ <code>Promise</code>
* [.source(source)](#module_jsdoc-api.explain.source) ⇒ <code>Promise</code>
* [.renderSync(files, [options])](#module_jsdoc-api.renderSync)
* [.source(source, [options])](#module_jsdoc-api.renderSync.source)
<a name="module_jsdoc-api.explain"></a>
### jsdoc-api.explain(source) ⇒ <code>object</code>
<a name="module_jsdoc-api.explainSync"></a>
### jsdoc.explainSync(files) ⇒ <code>object</code>
**Kind**: static method of <code>[jsdoc-api](#module_jsdoc-api)</code>
**Returns**: <code>object</code> - - json
**Returns**: <code>object</code> - - jsdoc explain output
| Param | Type | Description |
| --- | --- | --- |
| files | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | input file names |
<a name="module_jsdoc-api.explainSync.source"></a>
#### explainSync.source(source) ⇒ <code>Array.&lt;object&gt;</code>
**Kind**: static method of <code>[explainSync](#module_jsdoc-api.explainSync)</code>
**Returns**: <code>Array.&lt;object&gt;</code> - - jsdoc explain output
| Param | Type | Description |
| --- | --- | --- |
| source | <code>string</code> | source code |
<a name="module_jsdoc-api.render"></a>
### jsdoc-api.render(source, [options])
<a name="module_jsdoc-api.explain"></a>
### jsdoc.explain(files) ⇒ <code>Promise</code>
**Kind**: static method of <code>[jsdoc-api](#module_jsdoc-api)</code>
**Fulfil**: <code>object[]</code> - jsdoc explain output
| Param | Type | Description |
| --- | --- | --- |
| files | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | input source files |
<a name="module_jsdoc-api.explain.source"></a>
#### explain.source(source) ⇒ <code>Promise</code>
**Kind**: static method of <code>[explain](#module_jsdoc-api.explain)</code>
**Fulfil**: <code>object[]</code> - jsdoc explain output
| Param | Type | Description |
| --- | --- | --- |
| source | <code>string</code> | input source code |
<a name="module_jsdoc-api.renderSync"></a>
### jsdoc.renderSync(files, [options])
**Kind**: static method of <code>[jsdoc-api](#module_jsdoc-api)</code>
| Param | Type | Description |
| --- | --- | --- |
| files | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | input source files |
| [options] | <code>object</code> | options |
| [options.destination] | | destination path |
<a name="module_jsdoc-api.renderSync.source"></a>
#### renderSync.source(source, [options])
**Kind**: static method of <code>[renderSync](#module_jsdoc-api.renderSync)</code>
| Param | Type | Description |
| --- | --- | --- |
| source | <code>string</code> | the source code |

@@ -36,0 +77,0 @@ | [options] | <code>object</code> | options |

var test = require('tape')
var jsdoc = require('../')
var Fixture = require('./lib/fixture')
var collectJson = require('collect-json')

@@ -43,2 +44,3 @@ test('.explainSync(files, options)', function (t) {

.then(function (output) {
console.log(output)
var expectedOutput = f.getExpectedOutput()

@@ -50,3 +52,13 @@ Fixture.removeFileSpecificData(output, expectedOutput)

test('.createExplainStream(files, options)')
test('.createExplainStream(files, options)', function (t) {
t.plan(1)
var f = new Fixture('global/class-all')
jsdoc.createExplainStream(f.sourcePath)
.pipe(collectJson(output => {
var expectedOutput = f.getExpectedOutput()
Fixture.removeFileSpecificData(output, expectedOutput)
t.deepEqual(output, expectedOutput)
}))
})
test('.createExplainStream.source(source, options)')
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc