Namespace: formatter

kdljs.formatter

Source:

Methods

(static) format(doc, optionsopt) → {string}

Parameters:
Name Type Attributes Default Description
doc module:kdljs~Document

Input KDL document

options module:kdljs.formatter.Options <optional>
{}

Formatting options

Source:
Returns:

formatted KDL file

Type
string

Type Definitions

Options

Type:
  • Object
Properties:
Name Type Attributes Default Description
escapes Object.<number, boolean> <optional>
{}

A map of which characters to escape (by decimal codepoint)

requireSemicolons boolean <optional>
false

Whether to print semicolons after each node

escapeNonAscii boolean <optional>
false

Whether to escape any non-ASCII characters

escapeNonPrintableAscii boolean <optional>
true

Whether to escape non-printable ASCII characters

escapeCommon boolean <optional>
true

Whether to escape common characters (i.e. those with single-character escape codes)

escapeLinespace boolean <optional>
true

Whether to escape linespace characters

newline string <optional>
'\n'

The newline character

indent number <optional>
4

The number of characters (from indentChar) to indent each level with

indentChar string <optional>
' '

What character to indent with

exponentChar string <optional>
'E'

What character to use for the exponent in floats (e or E)

printEmptyChildren boolean <optional>
false

Whether to print empty brackets if a node has no children

printNullArgs boolean <optional>
true

Whether to print null values

printNullProps boolean <optional>
true

Whether to print properties with value null

Source: