Skip to main content

LineBuilder

Classes

Line
LineBuilder

Useful for creating formatted snippets of code

Line

Kind: global class

new Line(text, indent)

ParamType
textstring
indentnumber

line.text : string

Kind: instance property of Line

line.indentation : number

Kind: instance property of Line

LineBuilder

Useful for creating formatted snippets of code

Kind: global class

lineBuilder.indentation ⇒ number

Current indentation level Mainly intended for testing

Kind: instance property of LineBuilder

lineBuilder.indentSpaces : number

TODO replace with indent string, that is tab, space or any combination or something else entirely

Kind: instance property of LineBuilder

lineBuilder.count ⇒ number

Number of lines

Kind: instance property of LineBuilder

lineBuilder.containsSubstring(term) ⇒ boolean

Substring test of per-line basis. A match can only span a single line, so multi-line matches will not be found.

Kind: instance method of LineBuilder

ParamType
termstring

lineBuilder.indent() ⇒ LineBuilder

Kind: instance method of LineBuilder

lineBuilder.dedent() ⇒ LineBuilder

Kind: instance method of LineBuilder

lineBuilder.add(line_text) ⇒ LineBuilder

Kind: instance method of LineBuilder

ParamType
line_textstring

lineBuilder.addLines(lines)

Kind: instance method of LineBuilder

ParamType
linesLineBuilder

lineBuilder.build() ⇒ string

Kind: instance method of LineBuilder

LineBuilder.fromText(text, [line_separator]) ⇒ LineBuilder

Kind: static method of LineBuilder

ParamTypeDefaultDescription
textstring
[line_separator]string"\n"defaults to new-line character