具有自动放样功能的JavaScript美化/格式化程序

时间:2015-09-21 01:18:31

标签: javascript code-formatting

我一直在寻找一个代码美化/格式化程序,它将为我做变量和函数放样。在我写的时候,我可能会有一个特别长的功能,而不是向上移动到顶部变为loft变量和函数,我会将它们添加到我所在的位置。然后我继续前进并忘记放置新的变量和函数。

我希望它能做到这样的事情。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Dosisod</title>

    <style>
        .Main-Title{
            color:lightblue;
            font-size: 25px;
        }
    </style>
</head>
<body>
    <p class="Main-Title">This Is A Test.</p>
</body>
</html>

应该美化到......

// ugly code
function myFunction(){
    //... 50 lines of code ...
    for(var i = 0; i < 100; i++){
        //... code ...
    }
    //... much more code and return some weeks later to add...
    for(var i = 0; i < 100; i++){  // cant remember if I have an i declared
                                   // so to be safe add the var token
        //... code ...
    }
    var blah = {};
    var arr = [blah,blah,blah];   // I am just to lazy to loft it while coding
    var iteratorFunction = function(item){    
        //... Building code as I write the dependent parts  so don't ...
        //... want to go up to the top all the time ...
    }
    arr.forEach(iteratorFunction);

}

0 个答案:

没有答案