{ "name": "js-beautify", "version": "1.5.10", "description": "jsbeautifier.org for node", "main": "js/index.js", "preferGlobal": true, "bin": { "css-beautify": "./js/bin/css-beautify.js", "html-beautify": "./js/bin/html-beautify.js", "js-beautify": "./js/bin/js-beautify.js" }, "directories": { "lib": "js/lib", "test": "js/test" }, "scripts": { "test": "./js/test/shell-smoke-test.sh", "update-codemirror": "npm install codemirror && rm -rf ./web/third-party/codemirror/* && cp ./node_modules/codemirror/LICENSE ./web/third-party/codemirror/ && cp ./node_modules/codemirror/README.md ./web/third-party/codemirror/ && cp -r ./node_modules/codemirror/lib ./web/third-party/codemirror/ && mkdir -p ./web/third-party/codemirror/mode && cp -r ./node_modules/codemirror/mode/javascript ./web/third-party/codemirror/mode/ && git add -Av ./web/third-party/codemirror" }, "bugs": { "url": "https://github.com/beautify-web/js-beautify/issues" }, "homepage": "http://jsbeautifier.org/", "repository": { "type": "git", "url": "git://github.com/beautify-web/js-beautify.git" }, "keywords": [ "beautify", "beautifier", "code-quality" ], "author": { "name": "Einar Lielmanis", "email": "einar@jsbeautifier.org" }, "contributors": [ { "name": "Vital Batmanov", "email": "vital76@gmail.com" }, { "name": "Chris J. Shull", "email": "chrisjshull@gmail.com" }, { "name": "Gian Marco Gherardi", "email": "gianmarco.gherardi@gmail.com" }, { "name": "Stan", "email": "stasson@orc.ru" }, { "name": "Vittorio Gambaletta", "email": "VittGam@vittgam.net" }, { "name": "Daniel Stockman", "email": "daniel.stockman@gmail.com" }, { "name": "Harutyun Amirjanyan", "email": "amirjanyan@gmail.com" }, { "name": "Nochum Sossonko", "email": "nsossonko@hotmail.com" }, { "name": "Liam Newman", "email": "bitwiseman@gmail.com" } ], "license": "MIT", "dependencies": { "config-chain": "~1.1.5", "mkdirp": "~0.5.0", "nopt": "~3.0.1" }, "devDependencies": { "jshint": "~2.8.0", "node-static": "~0.7.1", "mustache": "~1.1.0", "requirejs": "2.1.x", "benchmark": "1.0.0" }, "readme": "# JS Beautifier\n[![Build Status](https://img.shields.io/travis/beautify-web/js-beautify/master.svg)](http://travis-ci.org/beautify-web/js-beautify)\n[![NPM version](https://img.shields.io/npm/v/js-beautify.svg)](https://www.npmjs.com/package/js-beautify)\n[![Download stats](https://img.shields.io/npm/dm/js-beautify.svg)](https://www.npmjs.com/package/js-beautify)\n[![Join the chat at https://gitter.im/beautify-web/js-beautify](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/beautify-web/js-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[![NPM stats](https://nodei.co/npm/js-beautify.svg?downloadRank=true&downloads=true)](https://www.npmjs.org/package/js-beautify)\n\n\nThis little beautifier will reformat and reindent bookmarklets, ugly\nJavaScript, unpack scripts packed by Dean Edward’s popular packer,\nas well as deobfuscate scripts processed by\n[javascriptobfuscator.com](http://javascriptobfuscator.com/).\n\n# Usage\nYou can beautify javascript using JS Beautifier in your web browser, or on the command-line using node.js or python.\n\n## Web Browser\nOpen [jsbeautifier.org](http://jsbeautifier.org/). Options are available via the UI.\n\n## Python\nTo beautify using python:\n\n```bash\n$ pip install jsbeautifier\n$ js-beautify file.js\n```\n\nBeautified output goes to `stdout`.\n\nTo use `jsbeautifier` as a library is simple:\n\n``` python\nimport jsbeautifier\nres = jsbeautifier.beautify('your javascript string')\nres = jsbeautifier.beautify_file('some_file.js')\n```\n\n...or, to specify some options:\n\n``` python\nopts = jsbeautifier.default_options()\nopts.indent_size = 2\nres = jsbeautifier.beautify('some javascript', opts)\n```\n\n## JavaScript\n\nAs an alternative to the Python script, you may install the NPM package `js-beautify`. When installed globally, it provides an executable `js-beautify` script. As with the Python script, the beautified result is sent to `stdout` unless otherwise configured.\n\n```bash\n$ npm -g install js-beautify\n$ js-beautify foo.js\n```\n\nYou can also use `js-beautify` as a `node` library (install locally, the `npm` default):\n\n```bash\n$ npm install js-beautify\n```\n\n```js\nvar beautify = require('js-beautify').js_beautify,\n fs = require('fs');\n\nfs.readFile('foo.js', 'utf8', function (err, data) {\n if (err) {\n throw err;\n }\n console.log(beautify(data, { indent_size: 2 }));\n});\n```\n\n## Options\n\nThese are the command-line flags for both Python and JS scripts:\n\n```text\nCLI Options:\n -f, --file Input file(s) (Pass '-' for stdin)\n -r, --replace Write output in-place, replacing input\n -o, --outfile Write output to file (default stdout)\n --config Path to config file\n --type [js|css|html] [\"js\"]\n -q, --quiet Suppress logging to stdout\n -h, --help Show this help\n -v, --version Show the version\n\nBeautifier Options:\n -s, --indent-size Indentation size [4]\n -c, --indent-char Indentation character [\" \"]\n -e, --eol character(s) to use as line terminators. (default newline - \"\\\\n\")');\n -l, --indent-level Initial indentation level [0]\n -t, --indent-with-tabs Indent with tabs, overrides -s and -c\n -p, --preserve-newlines Preserve line-breaks (--no-preserve-newlines disables)\n -m, --max-preserve-newlines Number of line-breaks to be preserved in one chunk [10]\n -P, --space-in-paren Add padding spaces within paren, ie. f( a, b )\n -j, --jslint-happy Enable jslint-stricter mode\n -a, --space-after-anon-function Add a space before an anonymous function's parens, ie. function ()\n -b, --brace-style [collapse|expand|end-expand|none] [\"collapse\"]\n -B, --break-chained-methods Break chained method calls across subsequent lines\n -k, --keep-array-indentation Preserve array indentation\n -x, --unescape-strings Decode printable characters encoded in xNN notation\n -w, --wrap-line-length Wrap lines at next opportunity after N characters [0]\n -X, --e4x Pass E4X xml literals through untouched\n -n, --end-with-newline End output with newline\n -C, --comma-first Put commas at the beginning of new line instead of end\n --good-stuff Warm the cockles of Crockford's heart\n```\n\nThese largely correspond to the underscored option keys for both library interfaces, which have these defaults:\n\n```json\n{\n \"indent_size\": 4,\n \"indent_char\": \" \",\n \"eol\": \"\\n\",\n \"indent_level\": 0,\n \"indent_with_tabs\": false,\n \"preserve_newlines\": true,\n \"max_preserve_newlines\": 10,\n \"jslint_happy\": false,\n \"space_after_anon_function\": false,\n \"brace_style\": \"collapse\",\n \"keep_array_indentation\": false,\n \"keep_function_indentation\": false,\n \"space_before_conditional\": true,\n \"break_chained_methods\": false,\n \"eval_code\": false,\n \"unescape_strings\": false,\n \"wrap_line_length\": 0,\n \"wrap_attributes\": \"auto\",\n \"wrap_attributes_indent_size\": 4,\n \"end_with_newline\": false\n}\n```\n\nIn addition to CLI arguments, you may pass config to the JS executable via:\n\n * any `jsbeautify_`-prefixed environment variables\n * a `JSON`-formatted file indicated by the `--config` parameter\n * a `.jsbeautifyrc` file containing `JSON` data at any level of the filesystem above `$PWD`\n\nConfiguration sources provided earlier in this stack will override later ones.\n\nYou might notice that the CLI options and defaults hash aren't 100% correlated. Historically, the Python and JS APIs have not been 100% identical. For example, `space_before_conditional` is currently JS-only, and not addressable from the CLI script. There are a few other additional cases keeping us from 100% API-compatibility. Patches welcome!\n\n## Directives to Ignore or Preserve sections (Javascript only) \n\nBeautifier for supports directives in comments inside the file.\nThis allows you to tell the beautifier to preserve the formtatting of or completely ignore part of a file. \nThe example input below will remain changed after beautification\n\n```js\n// Use preserve when the content is not javascript, but you don't want it reformatted.\n/* beautify preserve:start */\n{\n browserName: 'internet explorer',\n platform: 'Windows 7',\n version: '8'\n}\n/* beautify preserve:end */\n\n// Use ignore when the content is not parsable as javascript. \nvar a = 1;\n/* beautify ignore:start */\n {This is some strange{template language{using open-braces?\n/* beautify ignore:end */\n```\n\n\n### CSS & HTML\n\nIn addition to the `js-beautify` executable, `css-beautify` and `html-beautify` are also provided as an easy interface into those scripts. Alternatively, `js-beautify --css` or `js-beautify --html` will accomplish the same thing, respectively.\n\n```js\n// Programmatic access\nvar beautify_js = require('js-beautify'); // also available under \"js\" export\nvar beautify_css = require('js-beautify').css;\nvar beautify_html = require('js-beautify').html;\n\n// All methods accept two arguments, the string to be beautified, and an options object.\n```\n\nThe CSS & HTML beautifiers are much simpler in scope, and possess far fewer options.\n\n```text\nCSS Beautifier Options:\n -s, --indent-size Indentation size [4]\n -c, --indent-char Indentation character [\" \"]\n -t, --indent-with-tabs Indent with tabs, overrides -s and -c\n -e, --eol Character(s) to use as line terminators. (default newline - \"\\\\n\")\n -n, --end-with-newline End output with newline\n -L, --selector-separator-newline Add a newline between multiple selectors\n -N, --newline-between-rules Add a newline between CSS rules\n\nHTML Beautifier Options:\n -s, --indent-size Indentation size [4]\n -c, --indent-char Indentation character [\" \"]\n -t, --indent-with-tabs Indent with tabs, overrides -s and -c\n -e, --eol Character(s) to use as line terminators. (default newline - \"\\\\n\")\n -n, --end-with-newline End output with newline\n -p, --preserve-newlines Preserve existing line-breaks (--no-preserve-newlines disables)\n -m, --max-preserve-newlines Maximum number of line-breaks to be preserved in one chunk [10]\n -I, --indent-inner-html Indent
and sections. Default is false.\n -b, --brace-style [collapse|expand|end-expand|none] [\"collapse\"]\n -S, --indent-scripts [keep|separate|normal] [\"normal\"]\n -w, --wrap-line-length Maximum characters per line (0 disables) [250]\n -A, --wrap-attributes Wrap attributes to new lines [auto|force] [\"auto\"]\n -i, --wrap-attributes-indent-size Indent wrapped attributes to after N characters [indent-size]\n -U, --unformatted List of tags (defaults to inline) that should not be reformatted\n -E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.\n```\n\n# License\n\nYou are free to use this in any way you want, in case you find this\nuseful or working for you but you must keep the copyright notice and license. (MIT)\n\n# Credits\n\n* Written by Einar Lielmanis,