Readability enhancement using code formatting with JSON

Enhancing Readability in JSON:

  • There will be two icons that are present at the right side of “Exception Control” that is helpful in enhancing the readability of huge blocks of code in script panel:
  • Word Wrap and Pretty print. 
  • The Pretty print would work well on compressed and mini blocks of code and it also formats these code blocks for enhancing readability.
  • The real code for formatting is as follows:

 function _getelement(b)

         {

          return _d.getElementById(b)

         }

         function nn_uf(b)

         {

         var c=arguments;

         return function()

        {

        b.apply(null,[].slice.apply(c).slice(1))

        }

        }

        function nn_uf(b,c,z)

       {

        var d=_d.createElement(b);

        return b && (d.id=c),z&&(d.className=z),d

        }

  • The code shown above could be formatted as follows:

 function _getele(b)

         {

         return _d.getElementById(b);

         }

        function nn_uf(b)

        {

        var c = arguments;

        return function ()

       {

        b.apply(null, [].slice.apply(c).slice(1));

        };

        }

        function nn_uf(b, c, z)

       {

        var d = _d.createElement(b);

        return x && (d.id = c) , j && (d.className = z) , d;

        }

Word wrapping

  • This will break very long lines in order to fit them within the available space of script pane.
  • This prevents horizontal scrolling of the script pane to view any line.