NAME
js-beautify - beautify, unpack or deobfuscate JavaScript
SYNOPSIS
jsbeautifier.py [options] <infile>
DESCRIPTION
Javascript beautifier (https://beautifier.io/)
-
<infile> can be "-", which means stdin.
Input options:
- -i, --stdin
-
Read input from stdin
Output options:
- -s, --indent-size=NUMBER
-
Indentation size. (default 4).
- -c, --indent-char=CHAR
-
Character to indent with. (default space).
- -e, --eol=STRING
-
Character(s) to use as line terminators. (default first newline in file, otherwise "\n")
- -t, --indent-with-tabs
-
Indent with tabs, overrides -s and -c
- -d, --disable-preserve-newlines
-
Do not preserve existing line breaks.
- -P, --space-in-paren
-
Add padding spaces within paren, ie. f( a, b )
- -E, --space-in-empty-paren
-
Add a single space inside empty paren, ie. f( )
- -j, --jslint-happy
-
More jslint-compatible output
- -a, --space-after-anon-function
-
Add a space before an anonymous function's parens, ie. function ()
- --space-after-named-function
-
Add a space before a named function's parens, i.e. function example ()
- -b, --brace-style=collapse
-
Brace style (collapse, expand, end-expand, none)(,preserve-inline)
- -k, --keep-array-indentation
-
Keep array indentation.
- --quiet
-
Suppress info about a file if nothing was changed.
- -r, --replace
-
Write output in-place, replacing input
- -o, --outfile=FILE
-
Specify a file to output to (default stdout)
- -f, --keep-function-indentation
-
Do not re-indent function bodies defined in var lines.
- -x, --unescape-strings
-
Decode printable chars encoded in \xNN notation.
- -X, --e4x
-
Pass E4X xml literals through untouched
- -C, --comma-first
-
Put commas at the beginning of new line instead of end.
-m,
- --max-preserve-newlines=NUMBER
-
Number of line-breaks to be preserved in one chunk (default 10)
- -O, --operator-position=STRING
-
Set operator position (before-newline, after-newline, preserve-newline)
- -w, --wrap-line-length
-
Attempt to wrap line when it exceeds this length. NOTE: Line continues until next wrap point is found.
- -n, --end-with-newline
-
End output with newline
- --indent-empty-lines
-
Keep indentation on empty lines
- --templating
-
List of templating languages (auto,none,django,erb,handlebars,php,smarty,angular) ["auto"] auto = none in JavaScript, all in html
- --editorconfig
-
Enable setting configuration from EditorConfig
Rarely needed options:
- --eval-code
-
evaluate code if a JS interpreter is installed. May be useful with some obfuscated script but poses a potential security issue.
- -l, --indent-level=NUMBER
-
Initial indentation level. (default 0).
- -h, --help, --usage
-
Prints this help statement.
- -v, --version
-
Show the version