title: Replace or append to string with Lodash
body: <p>I have an array with SQL statements:</p>
  
  <pre><code>    var sql=[ "select sum(custo) as TOTAL from PRS_CUSTOS_MATERIAL ",
                "select mes,sum(custo) as TOTAL from PRS_CUSTOS_MATERIAL GROUP BY mes"
     ];
  </code></pre>
  
  <p>and i need to put a where clause on each statement.
  The problem is when i have other clauses than WHERE i need to put the WHERE clause before all others. I try to do it like this but no luck.</p>
  
  <pre><code>var clauses=['GROUP','HAVING'];
      _.forEach(sql, function (sq, key) {
          clauses.map(function (clause) {
              if (sq.indexOf(clause) !== -1) {
                  debugger;
                  sql[key]=[sq.slice(0, sq.indexOf(clause)), ' where '+obj.where_str+' ', sq.slice(sq.indexOf(clause))].join('');
  
                  return false;
              }else{
                  debugger;
                  sql[key]=sq+" where " + obj.where_str;
                  return false;
              }
          });
      });
  </code></pre>