[lib] js-beautify

Reformat the code to readble format

Author
Jixun.Moe
Version
0.0.1.20180701193144
Created
2014-09-24
Updated
2018-07-01
License
N/A

Deprecated - this script (the re-upload) has not been updated for quite a while. Please use other ones instead.

Alternatives:


This has been set to auto-update from its official GitHub repo, you may also intrested to visit the Homepage.

You might want to require Lib Export Holder before @require this script, to prevent the library writes to global window scope.

Usage

For official usage document, see here.

// With [ Lib Export Holder ]
exports.js_beautify ('The Code', { options });

// Without [ Lib Export Holder ]
window.js_beautify ('The Code', { options });

// Options available
{
    "indent_size": 4,
    "indent_char": " ",
    "indent_level": 0,
    "indent_with_tabs": false,
    "preserve_newlines": true,
    "max_preserve_newlines": 10,
    "jslint_happy": false,
    "space_after_anon_function": false,
    "brace_style": "collapse",
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "space_before_conditional": true,
    "break_chained_methods": false,
    "eval_code": false,
    "unescape_strings": false,
    "wrap_line_length": 0
}

License

You are free to use this in any way you want, in case you find this useful or working for you but you must keep the copyright notice and license. (MIT)

Credits

  • Written by Einar Lielmanis, einar@jsbeautifier.org
  • Python version flourished by Stefano Sanfilippo a.little.coder@gmail.com
  • General maintenance and expansion by Liam Newman bitwiseman@gmail.com
  • Command-line for node.js by Daniel Stockman daniel.stockman@gmail.com

Thanks also to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, Dave Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Shull, Mathias Bynens, Vittorio Gambaletta and others.