node.tags

node-module, .\src\tags.js

this parses the "tags"

these are the first symbols of each line in a documentation-comment

Functions
private tags['*'](obj, line)

parses all lines beginning with *

* means description ( including ref and desc)

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

private tags['>'](obj, line)

parses all lines beginning with >

> means a tag, all following lines with - (or | in case of Usage) are associated to it

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

private tags['|'](obj, line)

parses all lines beginning with |

| means usage of the documented element

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

private tags['-'](obj, line, inherit)

parses all lines beginning with -

- means an option and is associated to a tag tags['>']optionParamLine

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

inherit

  • boolean

if true, the result is set directly on obj and not on obj.tags[lastTag]

private tags['='](obj, line, inherit)

parses all lines beginning with =

= means return values similar to - tags['-']optionParamLine

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

inherit

  • boolean

if true, the result is set directly on obj and not on obj.returns

private tags['#'](obj, line)

parses all lines beginning with #

# means dependency

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

private tags['!'](obj, line)

parses all lines beginning with !

! means author

Parameter

obj

  • object

the object to set

line

  • string

the line to parse

private optionParamLine(line, avoidName)

parses lines that are "option"-lines

these are usually used in - and =

Parameter

line

  • string

the line to parse

avoidName

  • boolean

if true, no name will be set on returned object

Returns

 

  • object

the object resulting from parsing the line

name

  • string

the name of the option ('' if avoidName is true)

desc

  • array

the description of the option (each item of the array is a line)

ref

  • array

the references of the option (each item if the array is a ref)

(opt.) type

  • array

an array of possible valid types surrounded by '(' and ')'

(opt.) defaults

  • string

which values are default used - surrounded by '<' and '>'

(opt.) valids

  • string

which values are valid - surrounded by '[' and ']'

private prettify(desc)

transforms `, * and _

parses the description of a function or module it transforms those to code, strong and em
`foo` == <code>foo</code>
*foo* == <strong>foo</strong>
_foo_ == <em>foo</strong>

Parameter

desc

  • string

the string to parse

Returns

 

  • string

the codified string

Usage
 var myCodeString = codify(myString);
private generateValids(valids)

generates all valids with type

walks through the array of valid values and checks the for a keyword keywordChecker

Parameter

valids

  • array

the array of valid values

Returns

 

  • object

the map for the value

raw

  • string

the string of valid value

type

  • string

the type of which the value is

Usage
 var obj = generateValids("['foo', true]");
private keywordChecker(text)

checks if a string matches a javascript keyword

Parameter

text

  • string

the string to test for a keyword

Returns

 

  • string

returns the type of the string
falls back to "default" if not identified

Usage
 var type = keywordChecker('true'); // returns boolean
public parseLine(obj, line)

parses the given line

Parameter

obj

  • object

the object which should be extended with the right property

line

  • string

the line to comment of the comment given

Usage
 var tags = require('tags')