Skip to content

Pick up name and parameters from exported functions #435

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

Merged
merged 2 commits into from
May 26, 2016

Conversation

arv
Copy link
Contributor

@arv arv commented May 26, 2016

This makes sure that we get the name and params from exported
functions/classes/vars.

For export default the name is inferred from the file name.

Towards #424

This makes sure that we get the name and params from exported
functions/classes/vars.

For export default the name is inferred from the file name.

Towards documentationjs#424
function f(x) {}
}).params, [{lineNumber: 3, name: 'x', title: 'param'}]);

t.deepEqual(evaluate(`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if you allowed template literals? If not I can change this to a string literal as needed.

@tmcw
Copy link
Member

tmcw commented May 26, 2016

Looks amazing! Thanks for helping with this.

Re: template strings - documentation.js is ES5 so far and this would be the first bit of ES6ish. Checking the charts, Node 4 and above support template strings, which is quite a few, but given that this is the first change that'd up the version and there's an existing ES5 pattern, can we use the existing pattern? It's the toComment method which uses .toString on a function - or if all of these are only a few lines, line concatenation would also work.

@arv
Copy link
Contributor Author

arv commented May 26, 2016

I'll change to a string.

I cannot use the function toString trick as used by toComment since export is only valid syntax at the top level.

@arv
Copy link
Contributor Author

arv commented May 26, 2016

Done. PTAL.

@tmcw tmcw mentioned this pull request May 26, 2016
@tmcw tmcw merged commit af5862a into documentationjs:master May 26, 2016
@arv arv deleted the exported-functions branch May 26, 2016 16:39
@tmcw tmcw mentioned this pull request May 27, 2016
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.

2 participants