Greasy Fork is available in English.

[lib] js-beautify

Reformat the code to readble format

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://greasyfork.org/scripts/5266-lib-js-beautify/code/%5Blib%5D%20js-beautify.js?version=609600

Autor
Jixun.Moe
Version
0.0.1.20180701193144
Erstellt am
24.09.2014
Letzte Aktualisierung
01.07.2018
Lizenz
n/a

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.