Module: jsdoc/name

A collection of functions relating to JSDoc symbol name manipulation.
Source:

Members

LONGNAMES

Source:

LONGNAMES :string

Longnames that have a special meaning in JSDoc.
Type:
  • string
Properties:
Name Type Description
ANONYMOUS string Longname used for doclets that do not have a longname, such as anonymous functions.
GLOBAL string Longname that represents global scope.
Source:

puncToScope

Source:

SCOPE :string

Names and punctuation marks that identify doclet scopes.
Type:
  • string
Properties:
Name Type Description
NAMES string
PUNC string
Source:

SCOPE

Source:

scopeToPunc

Source:

_

Source:

about

Source:

about

Source:

about

Source:

about

Source:

about

Source:

about

Source:

about

Source:

c

Source:

chunks

Source:

currentLongname

Source:

currentNameInfo

Source:

currentParent

Source:

currentParent

Source:

DEFAULT_SCOPE

Source:

description

Source:

description

Source:

DESCRIPTION

Source:

escape

Source:

hasAncestor

Source:

hasOwnProp

Source:

i

Source:

includeVariation

Source:

longname

Source:

longname

Source:

longname

Source:

longname

Source:

longname

Source:

longname

Source:

memberof

Source:

memberof

Source:

memberof

Source:

memberof

Source:

memberof

Source:

memberof

Source:

memberof

Source:

memberof

Source:

metaName

Source:

MODULE_NAMESPACE

Source:

name

Source:

name

Source:

name

Source:

name

Source:

nameInfo

Source:

nameInfo

Source:

options

Source:

p2

Source:

parts

Source:

parts

Source:

partsRegExp

Source:

previousName

Source:

previousName

Source:

processed

Source:

punc

Source:

puncAndName

Source:

puncAndNameIndex

Source:

puncToScope

Source:

REGEXP_DESCRIPTION

Source:

REGEXP_LEADING_SCOPE

Source:

REGEXP_NAME_DESCRIPTION

Source:

REGEXP_TRAILING_SCOPE

Source:

result

Source:

scope

Source:

scope

Source:

SCOPE_PUNC

Source:

SCOPE_PUNC_STRING

Source:

scopePunc

Source:

scopePunc

Source:

scopePunc

Source:

scopeToPunc

Source:

stringEnd

Source:

stringEnd

Source:

token

Source:

variation

Source:

variation

Source:

variation

Source:

Methods

applyNamespace(longname, ns) → {string}

Parameters:
Name Type Description
longname string The full longname of the symbol.
ns string The namespace to be applied.
Source:
Returns:
The longname with the namespace applied.
Type
string

combine()

Source:

getBasename(name) → {string}

Parameters:
Name Type Description
name string The symbol's longname.
Source:
Returns:
The symbol's basename.
Type
string

hasAncestor(parent, child) → {boolean}

Check whether a parent longname is an ancestor of a child longname.
Parameters:
Name Type Description
parent string The parent longname.
child string The child longname.
Source:
Returns:
`true` if the parent is an ancestor of the child; otherwise, `false`.
Type
boolean

longnamesToTree(longnames, doclets) → {Object}

Convert an array of doclet longnames into a tree structure, optionally attaching doclets to the tree. Each level of the tree is an object with the following properties: + `longname {string}`: The longname. + `memberof {string?}`: The memberof. + `scope {string?}`: The longname's scope, represented as a punctuation mark (for example, `#` for instance and `.` for static). + `name {string}`: The short name. + `doclet {Object?}`: The doclet associated with the longname, or `null` if the doclet was not provided. + `children {Object?}`: The children of the current longname. Not present if there are no children. For example, suppose you have the following array of doclet longnames: ```js [ "module:a", "module:a/b", "myNamespace", "myNamespace.Foo", "myNamespace.Foo#bar" ] ``` This method converts these longnames to the following tree: ```js { "module:a": { "longname": "module:a", "memberof": "", "scope": "", "name": "module:a", "doclet": null, "children": { "/b": { "longname": "module:a/b", "memberof": "module:a", "scope": "/", "name": "b", "doclet": null } } }, "myNamespace": { "longname": "myNamespace", "memberof": "", "scope": "", "name": "myNamespace", "doclet": null, "children": { ".Foo": { "longname": "myNamespace.Foo", "memberof": "myNamespace", "scope": ".", "name": "Foo", "doclet": null, "children": { "#bar": { "longname": "myNamespace.Foo#bar", "memberof": "myNamespace.Foo", "scope": "#", "name": "bar", "doclet": null } } } } } } ```
Parameters:
Name Type Description
longnames Array.<string> The longnames to convert into a tree.
doclets Object.<string, module:jsdoc/doclet.Doclet> The doclets to attach to a tree. Each property should be the longname of a doclet, and each value should be the doclet for that longname.
Source:
Returns:
A tree with information about each longname in the format shown above.
Type
Object

resolve(doclet)

Resolves the longname, memberof, variation and name values of the given doclet.
Parameters:
Name Type Description
doclet module:jsdoc/doclet.Doclet
Source:

shorten(longname, forcedMemberof) → {object}

Given a longname like "a.b#c(2)", slice it up into an object containing the memberof, the scope, the name, and variation.
Parameters:
Name Type Description
longname string
forcedMemberof string
Source:
Returns:
Representing the properties of the given name.
Type
object

splitName(nameDesc) → {object}

Split a string that starts with a name and ends with a description into its parts.
Parameters:
Name Type Description
nameDesc string
Source:
Returns:
Hash with "name" and "description" properties.
Type
object

stripNamespace()

Source:

stripVariation()

Source:

atomize()

Source:

nameIsLongname()

Source:

splitLongname()

Source:

splitNameMatchingBrackets(nameDesc) → {object}

Split a string that starts with a name and ends with a description into its parts. Allows the defaultvalue (if present) to contain brackets. If the name is found to have mismatched brackets, null is returned.
Parameters:
Name Type Description
nameDesc string
Source:
Returns:
Hash with "name" and "description" properties.
Type
object