Skip to content

The @typicalname tag

Nathan McCallum edited this page Apr 26, 2019 · 2 revisions

1. Say you wrote Underscore.

/**
 * @module underscore
 */

/**
 * Find something where.
 */
exports.findWhere = function () {}

/**
 * Flatten an array.
 */
exports.flatten = function () {}

2. In the output, all method signatures start with underscore.:


underscore

underscore.findWhere()

Find something where.

Kind: static method of underscore

underscore.flatten()

Flatten an array.

Kind: static method of underscore


3. But nobody writes underscore., typically they write _.. To reflect this, use the jsdoc2md-specific @typicalname tag:

/**
 * @module underscore
 * @typicalname _
 */

/**
 * Find something where.
 */
exports.findWhere = function () {}

/**
 * Flatten an array.
 */
exports.flatten = function () {}

4. Now the output looks more realistic:


underscore

_.findWhere()

Find something where.

Kind: static method of underscore

_.flatten()

Flatten an array.

Kind: static method of underscore


Clone this wiki locally