title: Map function does not execute after saving
body: <p>I am creating the below map function it chouchdb 1.3.0. If I run it as a temporary view it works fine, but as soon as I save it, it fails to compile. </p>
  
  <pre><code>function(doc) {
      var datestamp = convert_date(doc["report"]["period"]);
      var report_suite = doc["report"]["reportSuite"]["id"];
      var segment = doc["report"]["segment_id"];
      emit([report_suite, segment, datestamp], [doc["report"]["elements"][0]["id"]]);
    }
  
  function convert_date(date){
      var months = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05",    "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12" };
      var year = date.substring(13, 17);
      var month = months[date.substring(8,11)];
      var day = date.substring(5,7).replace(" ", "0");
      var datestamp = year + month + day;
      return datestamp;
  }
  </code></pre>
  
  <p>The error message is: "Expression does not eval to a function"</p>
  
  <p>I have googled and tried unsuccessfully: </p>
  
  <ul>
  <li>Placing parentheses around the function</li>
  <li>inlining the convert_date function</li>
  </ul>