Skip to content
This repository

Beautifier for javascript

This branch is 0 commits ahead and 531 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 attic
Octocat-spinner-32 jquery
Octocat-spinner-32 php
Octocat-spinner-32 python
Octocat-spinner-32 tests
Octocat-spinner-32 third-party
Octocat-spinner-32 unpackers
Octocat-spinner-32 .gitmodules
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.md
Octocat-spinner-32 beautify-css.js
Octocat-spinner-32 beautify-html.js
Octocat-spinner-32 beautify.js
Octocat-spinner-32 favicon.png
Octocat-spinner-32 index.html
Octocat-spinner-32 license.txt
README.md

JS Beautifier

...or, more specifically, all of the code powering jsbeautifier.org.

This little beautifier will reformat and reindent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edward’s popular packer, as well as deobfuscate scripts processed by javascriptobfuscator.com.

To beautify from the command-line you can use provided python script/library.

./js-beautify file.js beautifies a file, output goes to stdout.

To use jsbeautifier as a library is simple:

import jsbeautifier
res = jsbeautifier.beautify('your javascript string')
res = jsbeautifier.beautify_file('some_file.js')

...or, to specify some options:

opts = jsbeautifier.default_options()
opts.indent_size = 2
res = jsbeautifier.beautify('some javascript', opts)

You are free to use this in any way you want, in case you find this useful or working for you.

Written by Einar Lielmanis, einar@jsbeautifier.org Python version flourished by Stefano Sanfilippo a.little.coder@gmail.com

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

Something went wrong with that request. Please try again.