Skip to content

Commit e67409e

Browse files
committed
More docs
1 parent d1e5baf commit e67409e

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Diff for: lib/infer/params.js

+18
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ var shouldSkipInference = require('./should_skip_inference'),
55
finders = require('./finders'),
66
flowDoctrine = require('../flow_doctrine');
77

8+
/**
9+
* Babel parses JavaScript source code and produces an abstract syntax
10+
* tree that includes methods and their arguments. This function takes
11+
* that AST and uses it to infer details that would otherwise need
12+
* explicit documentation, like the names of comments and their
13+
* default values.
14+
*
15+
* It is especially careful to allow the user and the machine to collaborate:
16+
* documentation.js should not overwrite any details that the user
17+
* explicitly sets.
18+
*
19+
* @private
20+
* @param {Object} param the abstract syntax tree of the parameter in JavaScript
21+
* @param {Object} comment the full comment object
22+
* @param {number} i the number of this parameter, in argument order
23+
* @param {string} prefix of the comment, if it is nested, like in the case of destructuring
24+
* @returns {Object} parameter with inference.
25+
*/
826
function paramToDoc(param, comment, i, prefix) {
927

1028
prefix = prefix || '';

Diff for: lib/input/expand_directories.js

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ var fs = require('fs');
22
var path = require('path');
33
var _ = require('lodash');
44

5+
/**
6+
* Given a list of indexes, expand those indexes that are paths
7+
* to directories into sub-lists of files. This does _not_ work
8+
* recursively and will throw an error if an index is not found
9+
*
10+
* @private
11+
* @throws {Error} if index is not found
12+
* @param {Array<Object|string>} indexes entry points given to documentatino
13+
* @param {Function} filterer method that avoids evaluating non-JavaScript files
14+
* @returns {Array<Object|string>} flattened array of file sources
15+
*/
516
function expandDirectories(indexes, filterer) {
617
return _.flatMap(indexes, function (index) {
718
if (typeof index !== 'string') {

0 commit comments

Comments
 (0)