mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
* build: Use Flow syntax without comments. We're switching to Flow annotations - not Flow comments. This gives documentation.js the ability to self-document without JSDoc types and improves our compatibility with tools like prettier. Fixes #729. Fixes #709
21 lines
616 B
JavaScript
21 lines
616 B
JavaScript
/* @flow */
|
|
|
|
/**
|
|
* Apply a function to all comments within a hierarchy: this iterates
|
|
* through children in the 'members' property.
|
|
*
|
|
* @param {Array<Object>} comments an array of nested comments
|
|
* @param {Function} fn a walker function
|
|
* @param {Object} [options] options passed through to walker function
|
|
* @returns {Array<Object>} comments
|
|
*/
|
|
export function walk(comments: Array<Comment>, fn: Function, options: ?Object) {
|
|
comments.forEach(comment => {
|
|
fn(comment, options);
|
|
for (var scope in comment.members) {
|
|
walk(comment.members[scope], fn, options);
|
|
}
|
|
});
|
|
return comments;
|
|
}
|