Class CommentsDocBuilder

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

Source : file CommentsDocBuilder.js at line 37

Constructor

new CommentsDocBuilder ( )

The constructor

Source : file CommentsDocBuilder.js at line 121

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 333

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 94

#beginSpaceNewlineRegExp : RegExp

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

Source : file CommentsDocBuilder.js at line 59

#commentsDoc : CommentsDoc

The currently builded comments

Source : file CommentsDocBuilder.js at line 44

#endSpaceNewlineRegExp : RegExp

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

Source : file CommentsDocBuilder.js at line 73

#multipleSpacesRegExp : RegExp

A RegExp to find multiple spaces

Source : file CommentsDocBuilder.js at line 80

#nameRegExp : RegExp

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

Source : file CommentsDocBuilder.js at line 115

#newLineStarSpaceRegExp : RegExp

A RegExp to find a new line folowwed by a star followed by a space

Source : file CommentsDocBuilder.js at line 101

#spaceNewlineRegExp : RegExp

A RegExp to find space or new line in the string

Source : file CommentsDocBuilder.js at line 66

#spaceNewlineSpaceRegExp : RegExp

A RegExp to find multiple spaces + newline +multiple spaces

Source : file CommentsDocBuilder.js at line 87

#tagRegExp : RegExp

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

Source : file CommentsDocBuilder.js at line 52

#typeRegExp : RegExp

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

Source : file CommentsDocBuilder.js at line 108

Private methods

#capitalizeFirstLetter ( text )

Set to uppercase the first letter of a text

Source : file CommentsDocBuilder.js at line 141

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 203

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 252

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 304

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 163

Parameters

Name Type Description
type String

The type tag to parse

Returns

The parsed type
Type : String