Use @callback name if present (fixes #136)

This commit is contained in:
John Firebaugh 2015-08-30 16:54:37 -07:00
parent 6940c30943
commit 3920fd2279
2 changed files with 15 additions and 3 deletions

View File

@ -20,12 +20,13 @@ module.exports = function inferName() {
return callback(null, comment);
}
// If this comment has a @class, @event, or @typedef tag with a name,
// use it.
// If this comment has a @class, @event, @typedef, or @callback
// tag with a name, use it.
var explicitNameTags = {
'class': 'name',
'event': 'description',
'typedef': 'description'
'typedef': 'description',
'callback': 'description'
};
for (var title in explicitNameTags) {

View File

@ -144,3 +144,14 @@ test('inferName - typedef', function (t) {
t.end();
});
});
test('inferName - callback', function (t) {
evaluate(function () {
/** @callback explicitCallback */
function implicitName() {}
return implicitName;
}, function (result) {
t.equal(result[ 0 ].name, 'explicitCallback');
t.end();
});
});