Class CommentsDocBuilder

Build a CommentsDoc object from the leading comments of a class, method, property or variable

Source : file CommentsDocBuilder.js at line 36

Constructor

new CommentsDocBuilder ( )

The constructor

Source : file CommentsDocBuilder.js at line 113

Public methods

build ( leadingComments )

Build a CommentsDoc object from the leading comments found in the code before the class/method/properties/variable

Source : file CommentsDocBuilder.js at line 321

Parameters

Name Type Description
leadingComments Array of String

The leadingComments to use

Returns

An object with the comments
Type : CommentsDoc

Private properties

#beginNewLineRegExp : RegExp

A RegExp to find a new line at the beginning of the string

Source : file CommentsDocBuilder.js at line 93

#beginSpaceNewlineRegExp : RegExp

A RegExp to find space or new line at the beginning of the string

Source : file CommentsDocBuilder.js at line 58

#commentsDoc : CommentsDoc

The currently builded comments

Source : file CommentsDocBuilder.js at line 43

#endSpaceNewlineRegExp : RegExp

A RegExp to find space or new line at the end of the string

Source : file CommentsDocBuilder.js at line 72

#multipleSpacesRegExp : RegExp

A RegExp to find multiple spaces

Source : file CommentsDocBuilder.js at line 79

#nameRegExp : RegExp

A RegExp to find a name the string ( the first word with only chars and numbers

Source : file CommentsDocBuilder.js at line 107

#spaceNewlineRegExp : RegExp

A RegExp to find space or new line in the string

Source : file CommentsDocBuilder.js at line 65

#spaceNewlineSpaceRegExp : RegExp

A RegExp to find multiple spaces + newline +multiple spaces

Source : file CommentsDocBuilder.js at line 86

#tagRegExp : RegExp

A RegExp to find the @desc, @classdesc, @sample,@type, @param, @return, @returns, @ignore tags

Source : file CommentsDocBuilder.js at line 51

#typeRegExp : RegExp

A RegExp to find a type in the string ( a string starting with { and ending with }

Source : file CommentsDocBuilder.js at line 100

Private methods

#capitalizeFirstLetter ( text )

Set to uppercase the first letter of a text

Source : file CommentsDocBuilder.js at line 132

Parameters

Name Type Description
text String

The text to capitalize

Returns

The capitalized text
Type : String

#getTypeDescription ( commentTag, haveName )

This method build a TypeDescription object from the contains of a comment tags

Source : file CommentsDocBuilder.js at line 194

Parameters

Name Type Description
commentTag String

The comment tag

haveName Boolean

A flag indicating that commentTag contains also a name to add in the TypeDescription

#parseCommentTag ( commentTag )

Parse a comment tag. A comment tag is a text starting at the beginning of a comment, just after the /** or starting with a @ char and finishing just before the next @ char in the comment or just before the */

Source : file CommentsDocBuilder.js at line 243

Parameters

Name Type Description
commentTag String

The comment tag to parse

#parseLeadingComment ( leadingComment )

Parse a leading comment and extracts the @desc, @classdesc, @sample,@type, @param, @return, @returns, @ignore tags

Source : file CommentsDocBuilder.js at line 295

Parameters

Name Type Description
leadingComment String

The comment to parse

#parseType ( type )

Parse a type tag ( the value into {} for a type, param, return or returns tags. Remove the { } < > ! and space chars from the type, replace the . char with ' of ', replace the ? char with 'null or ', replace the | char with ' or ' and finally capitalize the first letter of the types, so '{Number}' is parsed to 'Number', '{?String}' is parsed to 'null or String', 'Array.' is parsed to 'Array of Number', {String|Number} is parsed to 'String or Number'

Source : file CommentsDocBuilder.js at line 154

Parameters

Name Type Description
type String

The type tag to parse

Returns

The parsed type
Type : String