Skip to content

Commit

Permalink
style: Avoid optional parameter syntax
Browse files Browse the repository at this point in the history
Supporting this syntax uncorks a whole bottle of worms and requires participation in more of the
JavaScript ecosystem and is not worthwhile in my opinion at this time.

Fixes #873
  • Loading branch information
tmcw committed Aug 12, 2017
1 parent 233edb8 commit e0b605f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/NODE_API.md
Expand Up @@ -105,7 +105,7 @@ Formats documentation as HTML.
**Parameters**

- `comments` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment/Comment)>** parsed comments
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
- `config.theme` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Name of a module used for an HTML theme. (optional, default `'default_theme'`)

**Examples**
Expand All @@ -132,7 +132,7 @@ Formats documentation as
**Parameters**

- `comments` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** parsed comments
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output

**Examples**

Expand Down
5 changes: 4 additions & 1 deletion src/output/html.js
Expand Up @@ -23,7 +23,10 @@ var mergeConfig = require('../merge_config');
* streamArray(output).pipe(vfs.dest('./output-directory'));
* });
*/
function html(comments: Array<Comment>, config: Object = {}) {
function html(comments: Array<Comment>, config?: Object) {
if (!config) {
config = {};
}
return mergeConfig(config).then((config: DocumentationConfig) => {
var themePath = '../default_theme/';
if (config.theme) {
Expand Down
8 changes: 4 additions & 4 deletions src/output/markdown.js
Expand Up @@ -23,10 +23,10 @@ var remark = require('remark'),
* fs.writeFileSync('./output.md', output);
* });
*/
function markdown(
comments: Array<Comment>,
args: Object = {}
): Promise<string> {
function markdown(comments: Array<Comment>, args?: Object): Promise<string> {
if (!args) {
args = {};
}
return markdownAST(comments, args).then(ast => remark().stringify(ast));
}

Expand Down

0 comments on commit e0b605f

Please sign in to comment.