jsdoc2md / ddata

handlebars helpers for working with the documentation data output by jsdoc-parse
MIT License
1 stars 3 forks source link

Regex for filtering parameter names that contain a dot #2

Closed shaoner closed 8 years ago

shaoner commented 9 years ago

Hi,

Using an example will be simpler to explain but in method signature, when a parameter name contains a "." and a suffix which is not in [a-zA-Z0-9_], it's not filtered the same way: https://github.com/jsdoc2md/ddata/blob/master/lib/ddata.js#L595. I'm having this issue with jsdoc2md, for example:

/**
* @param {Object} [options]
* @param {boolean} [options.foo]
* @param {string} [options.$bar]
*/

This results into "[options], [options.$bar]" instead of "[options]".

Not entirely sure about what ES5 says about valid identifier names, but "$" is supposed to be valid. Taking all cases into account can be quite complicated, but at least this should work for US ascii even if incomplete:

!/[$A-Z_][0-9A-Z_$]*\.[$A-Z_][0-9A-Z_$]*/i.test(param.name);

or simply by filtering parameters that contain a ".":

!/\./.test(param.name);
75lb commented 9 years ago

Yes, $ and _ are valid.. Will look at this asap, thanks for the report

75lb commented 8 years ago

i apologise for the delay! this issue is fixed in the latest version of ddata (and jsdoc2md).