{"action":"created","issue":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/64","repository_url":"https://api.github.com/repos/nodeschool/discussions","labels_url":"https://api.github.com/repos/nodeschool/discussions/issues/64/labels{/name}","comments_url":"https://api.github.com/repos/nodeschool/discussions/issues/64/comments","events_url":"https://api.github.com/repos/nodeschool/discussions/issues/64/events","html_url":"https://github.com/nodeschool/discussions/issues/64","id":22341428,"number":64,"title":"Help with MAKE IT MODULAR..","user":{"login":"theCard","id":5604312,"avatar_url":"https://avatars.githubusercontent.com/u/5604312?v=3","gravatar_id":"","url":"https://api.github.com/users/theCard","html_url":"https://github.com/theCard","followers_url":"https://api.github.com/users/theCard/followers","following_url":"https://api.github.com/users/theCard/following{/other_user}","gists_url":"https://api.github.com/users/theCard/gists{/gist_id}","starred_url":"https://api.github.com/users/theCard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theCard/subscriptions","organizations_url":"https://api.github.com/users/theCard/orgs","repos_url":"https://api.github.com/users/theCard/repos","events_url":"https://api.github.com/users/theCard/events{/privacy}","received_events_url":"https://api.github.com/users/theCard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodeschool/discussions/labels/learnyounode","name":"learnyounode","color":"F0A028"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":66,"created_at":"2013-11-08T14:58:29Z","updated_at":"2016-04-15T13:21:15Z","closed_at":"2014-07-07T23:35:27Z","body":"I can't figure out what I am doing wrong. My ACTUAL matches my EXPECTED in the output, but I am getting this error...\r\n\r\nYour additional module file:\r\nP:\\NODEJS1\\chapter02\\mymodule.js\r\ndid not return the correct list of files in an array as the second argument of the callback.\r\n\r\nHere is my program...\r\n\r\n    var mymodule = require('./mymodule.js')\r\n\r\n    var dir = process.argv[2]\r\n    var ext = process.argv[3]\r\n\r\n    mymodule(dir, ext, function(err, list) {\r\n      if (err) {\r\n       throw err;\r\n      }\r\n      else list.forEach(function (file) {\r\n       console.log(file);\r\n      })\r\n    });\r\n\r\nAND THE MODULE...\r\n\r\n    var fs = require('fs')\r\n\r\n    module.exports = function(dirname, filter, callback) {\r\n\tvar regex = new RegExp('\\\\.' + filter + '$')\t\r\n\r\n\tvar filelist = new Array()\r\n\tvar i = 0\r\n\r\n\tfs.readdir(dirname, function (err, list) {\r\n\r\n\t\tif (err) {\r\n\t\treturn callback(err);\r\n\t\t}\r\n\t\telse list.forEach(function (file) {\r\n\t\tif (regex.test(file))\r\n\t\t\tfilelist[i] = file;\r\n\t\t\ti += 1;\r\n\t\t})\r\n\t\treturn callback(null, filelist)\r\n  \r\n\t})\r\n\r\n    };\r\n"},"comment":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/comments/210462045","html_url":"https://github.com/nodeschool/discussions/issues/64#issuecomment-210462045","issue_url":"https://api.github.com/repos/nodeschool/discussions/issues/64","id":210462045,"user":{"login":"anmolview","id":3226907,"avatar_url":"https://avatars.githubusercontent.com/u/3226907?v=3","gravatar_id":"","url":"https://api.github.com/users/anmolview","html_url":"https://github.com/anmolview","followers_url":"https://api.github.com/users/anmolview/followers","following_url":"https://api.github.com/users/anmolview/following{/other_user}","gists_url":"https://api.github.com/users/anmolview/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolview/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolview/subscriptions","organizations_url":"https://api.github.com/users/anmolview/orgs","repos_url":"https://api.github.com/users/anmolview/repos","events_url":"https://api.github.com/users/anmolview/events{/privacy}","received_events_url":"https://api.github.com/users/anmolview/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T13:21:15Z","updated_at":"2016-04-15T13:21:15Z","body":"#Pass\r\n\r\nprogram6.js\r\n\r\nvar dir = process.argv[2];\r\nvar format = process.argv[3];\r\nvar ls= require('./listfile.js');\r\n\r\nls(dir, format, function (err, data)\r\n{\r\n\tif(err)\r\n\t{\r\n\t\tconsole.log('error : '+err);\r\n\t}\r\n\tfor(i in data)\r\n\t{\r\n\t\t\tconsole.log(data[i]);\r\n\t}\r\n});\r\n\r\n\r\nlistfile.js\r\n\r\nvar dir = process.argv[2];\r\nvar format = process.argv[3];\r\nvar ls= require('./listfile.js');\r\n\r\nls(dir, format, function (err, data)\r\n{\r\n\tif(err)\r\n\t{\r\n\t\tconsole.log('error : '+err);\r\n\t}\r\n\r\n\tfor(i in data)\r\n\t{\r\n\t\tconsole.log(data[i]);\r\n\t}\r\n});\r\n"}}