NAME

JavaScript::Beautifier - Beautify Javascript (beautifier for javascript)

SYNOPSIS

use JavaScript::Beautifier qw/js_beautify/;

my $pretty_js = js_beautify( $js_source_code, {
    indent_size => 4,
    indent_character => ' ',
} );

EXPORT

This module is mostly a Perl-rewrite of http://github.com/einars/js-beautify/tree/master/beautify.js

You can check it through http://elfz.laacz.lv/beautify/

FUNCTIONS

js_beautify( $js_source_code, $opts );

beautify javascript.

$opts is a HASHREF, which contains indent_size and indent_character. if you prefer Tab than Space, try:

{
    indent_size => 1,
    indent_character => "\t",
}

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.