title: Javascript (node) error: Unexpected token function
body: <p>I am trying the learn younode workshop, the make it modular step to be precise. I wrote the code in the link and am getting the "error in the title". I have checked brackets and parenthesis but can not seem to find where i got it wrong. Any help would be appreciated (i just started with node).
  My code is this and you can find it also at this link:
  <a href="http://pastebin.com/G8x2GH7h" rel="nofollow">http://pastebin.com/G8x2GH7h</a></p>
  
  <pre><code>module.exports = function (directoryPath, extention, function(error, arrayOfNames) {
          var fs = require('fs');
          var path = require('path');
          var FileNamesArray = [];
          fs.readdir(directoryPath,function (error,list){
                  list.forEach(function (file) {
                          if (path.extname(file) === '.' + extention) {
                                  FileNamesArray.push(file);
                          }
                  });
          });
          return FileNamesArray;
          }){
          return ArrayOfNames;
  }
  </code></pre>