Repository navigation
escodegen.generate(AST[, options]);
{
format: {
indent: {
style: ' ',
base: 0
},
json: false,
renumber: false,
hexadecimal: false,
quotes: 'single',
escapeless: false,
compact: false
},
parse: null,
comment: false
}
-
option.format.indent.style: indent string (default is 4 space (' ')) -
option.format.indent.base: base indent level (default is 0) -
option.format.json: Enforce JSON format to number and string. This option is stronger thanoption.format.hexadecimalandoption.format.quotes. For number,option.format.renumberis also necessary (default is false) -
option.format.renumber: Generate more optimized number string (not using number.toString() simply) (default is false) -
option.format.hexadecimal: Generate hexadecimal number string. This option needsoption.format.renumber(default is false) -
option.format.quotes: Enforce quote to generate string literal. 'single', 'double' or 'auto' should be specified. When 'auto' is specified, escodegen selects quote by which result string is shorter. (default is 'single') -
option.format.escapeless: Use more aggressive escape sequence on string literal (default is false) -
option.format.compact: Minifying the output. newline and spaces are removed (default is false) -
option.parse: Mozilla Parser API compatible parse function. If it is provided, generator try to use 'raw' representation. See esprima raw information -
option.comment: If comments are attached to AST, escodegen emit comments to output code (default is false)