Skip to content

Commit e0b605f

Browse files
committed
style: Avoid optional parameter syntax
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
1 parent 233edb8 commit e0b605f

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

docs/NODE_API.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Formats documentation as HTML.
105105
**Parameters**
106106

107107
- `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
108-
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
108+
- `config` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
109109
- `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'`)
110110

111111
**Examples**
@@ -132,7 +132,7 @@ Formats documentation as
132132
**Parameters**
133133

134134
- `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
135-
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output (optional, default `{}`)
135+
- `args` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options that can customize the output
136136

137137
**Examples**
138138

src/output/html.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ var mergeConfig = require('../merge_config');
2323
* streamArray(output).pipe(vfs.dest('./output-directory'));
2424
* });
2525
*/
26-
function html(comments: Array<Comment>, config: Object = {}) {
26+
function html(comments: Array<Comment>, config?: Object) {
27+
if (!config) {
28+
config = {};
29+
}
2730
return mergeConfig(config).then((config: DocumentationConfig) => {
2831
var themePath = '../default_theme/';
2932
if (config.theme) {

src/output/markdown.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ var remark = require('remark'),
2323
* fs.writeFileSync('./output.md', output);
2424
* });
2525
*/
26-
function markdown(
27-
comments: Array<Comment>,
28-
args: Object = {}
29-
): Promise<string> {
26+
function markdown(comments: Array<Comment>, args?: Object): Promise<string> {
27+
if (!args) {
28+
args = {};
29+
}
3030
return markdownAST(comments, args).then(ast => remark().stringify(ast));
3131
}
3232

0 commit comments

Comments
 (0)