From 3920fd2279280f33467602105dc5fc125c987c19 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Sun, 30 Aug 2015 16:54:37 -0700 Subject: [PATCH] Use @callback name if present (fixes #136) --- streams/infer/name.js | 7 ++++--- test/streams/infer_name.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/streams/infer/name.js b/streams/infer/name.js index 207b3bb..95c6392 100644 --- a/streams/infer/name.js +++ b/streams/infer/name.js @@ -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) { diff --git a/test/streams/infer_name.js b/test/streams/infer_name.js index 373b502..113abab 100644 --- a/test/streams/infer_name.js +++ b/test/streams/infer_name.js @@ -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(); + }); +});