Greasy Fork is available in English.

[lib] js-beautify

Reformat the code to readble format

此脚本不应被直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://greasyfork.org/scripts/5266-lib-js-beautify/code/%5Blib%5D%20js-beautify.js?version=609600

作者
Jixun.Moe
得分
0 0 0
版本
0.0.1.20180701193144
创建日期
最近更新
许可协议
不适用
应用到
所有站点

脚本描述

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.