Lasse Reichstein Nielsen писал(а):
"mistral" <po*******@soft home.net> writes:
I there any good javascript formatter tool? (format javascript accurately, etc)
-----------------------------------------------------------------------------------------------
Most non-IE browsers can do it for you. Try the following in Firefox or
Opera:
function formatJS(jsText ) {
var funcString = new Function(jsText ).toString();
var match =
/^\s*function\s* \w*\s*\(\s*\)\s *\{([\s\S]*)\}\s*$/.exec(funcStrin g);
if (match) {
return match[1];
} else {
// unable to parse function expression
}
}
It's not perfect (it removes comments), but it doesn't get much
simpler :)
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors:
<URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
=============== =============== =========
Well, but I use Internet Explorer only.
Mistral