title: NodeJS. Async. Parallel. Same functions
body: <p>I need to parse 10 webpages, and catch their main contents. So I'm using node-readability and don't want to rewrite same functions(only url changes) 10 times. Finally I've to count up content lengths. How I can do it using loop or any other ideas?
  Now it looks like:</p>
  
  <pre><code>for(var i=0; i&lt;catchedUrl.length; i++){
      var data = {length: 0, count: 0};
      (function(i) {
          read(catchedUrl[i], function(err, article, meta){
              if(err) throw err;
  
              var content = article.content;
              content = content.split(' ');
              article.close();
              data.count += 1;
              data.length += length;
              // Send data to callback when functions done
          });
      })(i);
  }
  </code></pre>