title: Defining and using functions into Gruntfile.js
body: <p>I'm using a function to configure an object that I need in merge-json module. It works, but I don't know if this is a good or bad practice.</p>
  
  <pre><code>function getLanguageObj( src ){
  
      var inputTxt = '',
          inputObj = '',     
          tmp;
  
      for(var i in src){
          tmp = '';
          inputTxt += '"' + src[i].language + '":{files:[{src:[';
  
          for(var j in apps){
              tmp += '"&lt;%= ' + apps[j].app + '.app %&gt;/{,*/}*-' + src[i].language + '.json"';
              if( j &lt; (apps.length - 1) ){
                tmp += ',';
              }
          }
          inputTxt += tmp + '],dest:"&lt;%= secure.dist %&gt;/languages/locale-' + src[i].language + '.json"},{'
              + 'src:[' + tmp + '],dest:"&lt;%= secure.app %&gt;/languages/locale-' + src[i].language + '.json"}]}';
  
          if( i &lt; (src.length - 1) ){
            inputTxt += ',';
          }
      }
  
      inputObj = eval("(" + '{' + inputTxt + '}' + ")") ;
  
      return inputObj;
  
  }
  
  langObj = getLanguageObj( languages );  
  </code></pre>
  
  <p>In <code>grunt.initConfig</code> I used:</p>
  
  <pre><code>"merge-json": langObj
  </code></pre>