Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract parameters from methods, constructors and functions #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nknapp
Copy link

@nknapp nknapp commented Mar 21, 2017

This commit adds a property "ctx.params" (an array of strings)
to the parsed comment..

The rationale is that the @param-tags are not necessarily in the same
order as the parameters in the code. In the case of

/**
 * @param {number} a
 * @param {string} b
 */
function myFunction(b,a) {
}

it would otherwise not be possible to create the correct documentation
(that shows the correct order of the parameter)

This commit adds a property "ctx.params" (an array of strings)
to the parsed comment..

The rationale is that the @param-tags are not necessarily in the same
order as the parameters in the code. In the case of

/**
 * @param {number} a
 * @param {string} b
 */
function myFunction(b,a) {
}

it would otherwise not be possible to create the correct documentation
(that shows the correct order of the parameter)
@nknapp
Copy link
Author

nknapp commented Mar 22, 2017

Maybe consider this work-in-progress. I just realized, that there are a couple of cases that would break with this change.

/**
 * @param a
 * @param b
 */
function abc(a, ...b) {} 

/**
 * @param a
 * @param b
 * @param c
 * @param d
 */
function abc(a, {b,c,d}) {}

/**
 * @param a
 */
function abc(a /* , dynamic args */) {}

The question is, do you actually want to support this? Otherwise I would just use my own fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant