title: How to fix csv to json converter module?
body: <p>I can't figure out how to match the title and genre correctly based on what I have in my module. </p>
  
  <p>The csv_json module has an exception where it doesn't match each of the properties accordingly and that is when the title has "The" in it.</p>
  
  <p><code>//csv file</code></p>
  
  <p>movieId,title,genre</p>
  
  <p>1,"American President, The (1995)",Comedy|Drama|Romance
  2,"Creation, The creator(xxxx)",Comedy|Drama|Romance
  3,"Destruction, The destroyer(xxxxx)",Comedy|Drama|Romance</p>
  
  <pre class="lang-js prettyprint-override"><code>
  //csv_json module 
  const readline = require('readline');
  const fs = require('fs');
  
  function readCsv(pathToFile) {
      return new Promise((resolve, reject) =&gt; {
          const csvReader = readline.createInterface({
              input: fs.createReadStream(pathToFile)
          });
  
          let headers;
          const rows = [];
          let tempRows = [];
          csvReader
              .on('line', row =&gt; {
                  if (!headers) {
                      headers = row.split(','); // header name breed age
                  } else {
                      rows.push(row.split(','));
                  }
              })
              .on('close', () =&gt; {
                  // then iterate through all of the "rows", matching them to the "headers"
                  for (var i = 0; i &lt; rows.length; i++) {
                      var obj = {};
                      var currentline = rows[i];
  
                      for (var j = 0; j &lt; headers.length; j++) {
                          obj[headers[j]] = currentline[j]; //Kitty Siamese 14
                      }
  
                      tempRows.push(obj);
                  }
  
                  resolve(JSON.stringify(tempRows));
              });
  
          // This would be in place of the "return" statement you had before
      });
  }
  
  module.exports = readCsv;
  </code></pre>
  
  <pre><code>//js file
  const readCsv = require('./csvjson.js');
  
  readCsv('movieTest.csv').then((data) =&gt; {
      console.log(data)
      let movieJson = JSON.parse(data);
      console.log(movieJson)
  
  
  /*data output:
  [{"movieId":"1","title":"\"American President","genre":" The (1995)\""},{"movieId":"2","title":"\"Creation","genre":" The creator(xxxx)\""},{"movieId":"3","title":"\"Destruction","genre":" The destroyer(xxxxx)\""}]
  
  */
  /*movieJson output:
  [ { movieId: '1',
      title: '"American President',
      genre: ' The (1995)"' },
    { movieId: '2',
      title: '"Creation',
      genre: ' The creator(xxxx)"' },
    { movieId: '3',
      title: '"Destruction',
      genre: ' The destroyer(xxxxx)"' } ]
  */
  });
  </code></pre>
  
  <p>I expect the output to match:</p>
  
  <pre class="lang-js prettyprint-override"><code>[ { movieId: '1',
      title: "American President, The (1995)",
      genre:'Comedy|Drama|Romance' },
    { movieId: '2',
      title: "The creator(xxxx) Creation",
      genre: ' Comedy|Drama|Romance' },
    { movieId: '3',
      title: "Destruction The destroyer(xxx)",
      genre: ' Comedy|Drama|Romance' } ]
  </code></pre>