title: Stringify error with parallel.js
body: <p>I am trying to parallelize a JavaScript project using parallel.js, but I am running into some kind of parsing problems. </p>
  
  <p>The goal of the project is to have 9 ticket-sellers process customers in parallel. We have a working code right now, but the processing of the customers is still asynchronous, and we are trying to achieve the parallelization part using parallel.js.</p>
  
  <p>My original code in JS before parallelizing is:</p>
  
  <pre><code>var ticketers = ["H", "M1", "M2", ...]; //There are 9 ticket-sellers
  
  for(var i = 0; i &lt; ticketers.length; i++) {
       ticketerBehavior(i);
  }
  </code></pre>
  
  <p>Where ticketers are the 9 ticket-sellers, and ticketerBehavior() is the function that takes care of what happens when a ticket-seller receives a customer.</p>
  
  <p>Using the parallel.js documentation and examples, this is what we tried out:</p>
  
  <pre><code>var ticketBehav = function(ticketers){
      for (var i = 0; i &lt; ticketers.length; i++)
              ticketerBehavior(i);
  };
  
  var p = new Parallel(100);
  p.spawn(ticketBehav(ticketers)).then(console.log(ticketBehav(ticketers)));
  </code></pre>
  
  <p>However, when we run the program, it gives us this error:</p>
  
  <pre><code>/home/user/node_modules/paralleljs/lib/parallel.js:106
          return preStr + 'process.on("message", function(e)      {process.send(JSON.stringify((' + cb.toString() + ')(JSON.parse(e).data)))})';
                                                                                                 ^
  
  TypeError: Cannot read property 'toString' of undefined
  at Parallel.getWorkerSource (/home/user/node_modules/paralleljs/lib/parallel.js:106:91)
  </code></pre>
  
  <p>I tried googling the error but it does not return any results so far. I was a little confused on how to troubleshoot this error, since our data is technically serializable as JSON since they are only strings. Would a version compatibility cause any issues with running parallel.js as well?</p>
  
  <p>Could anyone please advise me on where to start troubleshooting? Any tips/advice would be appreciated. Thank you!</p>