Skip to content

Commit e25919b

Browse files
committed
Improve internal documentation
1 parent 69a0fdc commit e25919b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/infer/finders.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
var t = require('babel-types');
22

3+
/**
4+
* Try to find the part of JavaScript a comment is referring to, by
5+
* looking at the syntax tree closest to that comment.
6+
*
7+
* @param {Object} path abstract syntax tree path
8+
* @returns {?Object} ast node, if one is found.
9+
* @private
10+
*/
311
function findTarget(path) {
412

513
if (!path) {
@@ -27,6 +35,14 @@ function findTarget(path) {
2735
return path;
2836
}
2937

38+
/**
39+
* Try to find a JavaScript class that this comment refers to,
40+
* whether an expression in an assignment, or a declaration.
41+
*
42+
* @param {Object} node abstract syntax tree node
43+
* @returns {?Object} ast node, if one is found.
44+
* @private
45+
*/
3046
function findClass(node) {
3147
var target = findTarget(node);
3248
return (t.isClassDeclaration(target) || t.isClassExpression(target)) && target;

lib/infer/membership.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ var n = require('babel-types'),
66
isJSDocComment = require('../../lib/is_jsdoc_comment'),
77
parse = require('../../lib/parse');
88

9+
/**
10+
* Given an AST node, try to find a comment in front of it that
11+
* has a `lends` tag, and if it has that, return the tag, split by
12+
* .s.
13+
*
14+
* @private
15+
* @param {Object} node AST node
16+
* @returns {string|undefined} lends identifier, if any
17+
*/
918
function findLendsIdentifiers(node) {
1019
if (!node || !node.leadingComments) {
1120
return;
@@ -44,6 +53,7 @@ function extractIdentifiers(path) {
4453

4554
/**
4655
* Count leading identifiers that refer to a module export (`exports` or `module.exports`).
56+
* @private
4757
* @param {Object} comment parsed comment
4858
* @param {Array<string>} identifiers array of identifier names
4959
* @returns {number} number of identifiers referring to a module export (0, 1 or 2)
@@ -65,6 +75,7 @@ function countModuleIdentifiers(comment, identifiers) {
6575
* tags from the placement of JSDoc
6676
* annotations within a file
6777
*
78+
* @private
6879
* @param {Object} comment parsed comment
6980
* @returns {Object} comment with membership inferred
7081
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy