javascript closures and returning array elements
<p>I'm trying to learn javascript to work with node.js and obviously don't quite get closures.
I'm try to read a file, line by line, parse the line and put the result into an array and return the array.  Here's what I have (doesn't quite work):</p>

<pre><code>var fs = require('fs'), Lazy = require('lazy');

function parseMyFile (filename) {
    var myArray= [];
    var lazy = new Lazy (fs.createReadStream(filename));

    lazy
        .lines
        .map(function(line){
            var parts = line.toString().split('|');

            var item = {
              bucket:   parts[1],
              uri:      parts[2].substring(2),
              token:    parts[0],
              fileDate: parts[3]
           };          

           myArray.push (item);
        });

     console.log(myArray);  // empty

         return myArray;
};


var myItems = parseMyFile ('Tokens.csv');
</code></pre>

<p>I'm sure this has something to do with closures, just not quite getting it.  Any help would be appreciated.</p>

<p>Thanks!</p>
