API Docs for: 0.1.0

Class DocParser

Extends: Base
Class defined in: lib/docparser.js:582

The doc parser accepts a map of files to file content. Once parse() is called, various properties will be populated with the parsers data (aggregated in the 'data' property).

DocParser ( o )
lib/docparser.js:582 Parameters:
  • o <Object> the config object
String _resolveFor ( value ) /* private method */
lib/docparser.js:791

Takes a non-namespaced classname and resolves it to a namespace (to support @for)

Parameters:
  • value <String> The classname to resolve

Returns: <String> The resolved namespace + classname
Object extract ( filemap, dirmap )
lib/docparser.js:949

Accepts a map of filenames to file content. Returns a map of filenames to an array of API comment block text. This expects the comment to start with / ** on its own line, and end with * / on its own line. Override this function to provide an alternative comment parser.

Parameters:
  • filemap <Object> A map of filenames to file content
  • dirmap <Array> A map of file names to directory name

Returns: <Object> A map of filenames to an array of extracted
String fixType ( t ) /* private method */
lib/docparser.js:6

Takes a type string and converts it to a "First letter upper cased" type. e.g. (string -> String, object -> Object)

Parameters:
  • t <String> The type string to convert

Returns: <String> The fixed string
DocParser parse ( filemap, dirmap )
lib/docparser.js:1136

Extracts and transforms the filemap provided to constructor

Parameters:
  • filemap <Array> A map of filenames to file content
  • dirmap <Array> A map of file names to directory name

Returns: <DocParser> this parser instance. The total results
processblock ( an )
lib/docparser.js:1002

Processes all the tags in a single comment block

Parameters:
  • an <Array> array of the tag/text pairs
String stringlog ( data ) /* private method */
lib/docparser.js:19

Parses the JSON data and formats it into a nice log string for filename and line number: /file/name.js:123

Parameters:
  • data <Object> The data block from the parser

Returns: <String> The formatted string.
Object transform ( commentmap )
lib/docparser.js:1070

Transforms a map of filenames to arrays of comment blocks into a JSON structure that represents the entire processed API doc info and relationships between elements for the entire project.

Parameters:
  • commentmap <Object> The hash of files and parsed comment blocks

Returns: <Object> The transformed data for the project
String unindent ( content ) /* private method */
lib/docparser.js:862

Normalizes the initial indentation of the given content so that the first line is unindented, and all other lines are unindented to the same degree as the first line. So if the first line has four spaces at the beginning, then all lines will be unindented four spaces. Ported from Selleck

Parameters:
  • content <String> Text to unindent.

Returns: <String> Unindented text.
CORRECTIONS <Object> (final)
lib/docparser.js:160

Common errors will get scrubbed instead of being ignored.

DIGESTERS <Object> (final)
lib/docparser.js:179

A map of the default tag processors, keyed by the tag name. Multiple tags can use the same digester by supplying the string name that points to the implementation rather than a function.

TAGLIST <Array> (final)
lib/docparser.js:83

A list of known tags. This populates a member variable during initialization, and will be updated if additional digesters are added.

digesters
lib/docparser.js:602

Digesters process the tag/text pairs found in a comment block. They are looked up by tag name. The digester gets the tagname, the value, the target object to apply values to, and the full block that is being processed. Digesters can be declared as strings instead of a function -- in that case, the program will try to look up the key listed and use the function there instead (it is an alias). Digesters can return a host object in the case the tag defines a new key block type (modules/classes/methods/events/properties)

Fires: digestersChange(e)

Fires when the value for the configuration attribute digesters is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
emitters
lib/docparser.js:624

Emitters will be schemas for the types of payloads the parser will emit. Not implemented.

Fires: emittersChange(e)

Fires when the value for the configuration attribute emitters is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
filemap
lib/docparser.js:635

The map of file names to file content.

Fires: filemapChange(e)

Fires when the value for the configuration attribute filemap is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
dirmap
lib/docparser.js:643

A map of file names to directory name. Provided in case this needs to be used to reset the module name appropriately -- currently not used

Fires: dirmapChange(e)

Fires when the value for the configuration attribute dirmap is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
currentfile <String>
lib/docparser.js:653

The file currently being parsed

Fires: currentfileChange(e)

Fires when the value for the configuration attribute currentfile is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
mainmodule <String>
lib/docparser.js:674

The main documentation block for the module itself.

Fires: mainmoduleChange(e)

Fires when the value for the configuration attribute mainmodule is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
currentmodule <String>
lib/docparser.js:697

The module currently being parsed

Fires: currentmoduleChange(e)

Fires when the value for the configuration attribute currentmodule is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
currentsubmodule <String>
lib/docparser.js:724

The submodule currently being parsed

Fires: currentsubmoduleChange(e)

Fires when the value for the configuration attribute currentsubmodule is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set
currentclass <String>
lib/docparser.js:755

The class currently being parsed

Fires: currentclassChange(e)

Fires when the value for the configuration attribute currentclass is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
e <EventFacade> An Event Facade object with the following attribute specific properties added:
  • prevVal The value of the attribute, prior to it being set
  • newVal The value the attribute is to be set to
  • attrName The name of the attribute being set
  • subAttrName If setting a property within the attribute's value, the name of the sub-attribute property being set