{"action":"created","issue":{"url":"https://api.github.com/repos/workshopper/learnyounode/issues/305","labels_url":"https://api.github.com/repos/workshopper/learnyounode/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/workshopper/learnyounode/issues/305/comments","events_url":"https://api.github.com/repos/workshopper/learnyounode/issues/305/events","html_url":"https://github.com/workshopper/learnyounode/issues/305","id":81675193,"number":305,"title":"Make it Modular, why is this not passing?","user":{"login":"crumpx","id":4764314,"avatar_url":"https://avatars.githubusercontent.com/u/4764314?v=3","gravatar_id":"","url":"https://api.github.com/users/crumpx","html_url":"https://github.com/crumpx","followers_url":"https://api.github.com/users/crumpx/followers","following_url":"https://api.github.com/users/crumpx/following{/other_user}","gists_url":"https://api.github.com/users/crumpx/gists{/gist_id}","starred_url":"https://api.github.com/users/crumpx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crumpx/subscriptions","organizations_url":"https://api.github.com/users/crumpx/orgs","repos_url":"https://api.github.com/users/crumpx/repos","events_url":"https://api.github.com/users/crumpx/events{/privacy}","received_events_url":"https://api.github.com/users/crumpx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-27T23:45:10Z","updated_at":"2015-05-28T00:07:01Z","closed_at":null,"body":"program6.js\r\n```\r\nvar countline = require('./mymodule.js');\r\ndirPath = process.argv[2];\r\nextFilter = process.argv[3];\r\n\r\ncountline(dirPath, extFilter, function (err, list){\r\n\tif (err) {console.log(err);}\r\n\telse {\r\n\t\tfor (item in list)\r\n\t\t\t{console.log(list[item]);}\r\n\t}\r\n})\r\n```\r\n\r\nmymodule.js\r\n```\r\nvar fs = require('fs');\r\nvar path = require('path');\r\n\r\nmodule.exports = function(dirpath, filter, callback){\r\n\t\tfs.readdir(dirPath, function (err, list) {\r\n\t\t\tif (err) {\r\n\t\t\t\tconsole.log\r\n\t\t\t\treturn callback(err);\r\n\t\t\t}\r\n\t\t\telse {\t\t\t\t\r\n\t\t\t\tvar newList = []\r\n\t\t\t\tfor (item in list) {\r\n\t\t\t\t\tif (path.extname(list[item]).slice(1) === extFilter) {\r\n\t\t\t\t\t\tnewList.push(list[item]);\r\n\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\treturn callback(null, newList)\r\n\r\n\t    \t}\r\n})\r\n}\r\n```\r\nthis script does what it supposed to do, and will return error if I fed a fake path to it. however it cannot pass the verification, I'm brand new to javascript and node.js...so i'm wondering what could be wrong here. can someone explain? thanks.\r\n\r\n```\r\nYour submission results compared to the expected:\r\n\r\n                 ACTUAL                                 EXPECTED\r\n────────────────────────────────────────────────────────────────────────────────\r\n\r\n   \"CHANGELOG.md\"                      ==    \"CHANGELOG.md\"\r\n   \"LICENCE.md\"                        ==    \"LICENCE.md\"\r\n   \"README.md\"                         ==    \"README.md\"\r\n   \"\"                                  ==    \"\"\r\n\r\n────────────────────────────────────────────────────────────────────────────────\r\n\r\n✓ Submission results match expected\r\n✓ Additional module file exports a single function\r\n✓ Additional module file exports a function that takes 3 arguments\r\n✗ Your additional module file [mymodule.js] does not appear to pass back an error received from `fs.readdir()`.\r\n  Use the following idiomatic Node.js pattern inside your callback to `fs.readdir()`:\r\n\tif (err)\r\n\t  return callback(err)\r\n\r\n# FAIL\r\n\r\nYour solution to MAKE IT MODULAR didn't pass. Try again!\r\n\r\nError cleaning up: testing\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/workshopper/learnyounode/issues/comments/106116484","html_url":"https://github.com/workshopper/learnyounode/issues/305#issuecomment-106116484","issue_url":"https://api.github.com/repos/workshopper/learnyounode/issues/305","id":106116484,"user":{"login":"crumpx","id":4764314,"avatar_url":"https://avatars.githubusercontent.com/u/4764314?v=3","gravatar_id":"","url":"https://api.github.com/users/crumpx","html_url":"https://github.com/crumpx","followers_url":"https://api.github.com/users/crumpx/followers","following_url":"https://api.github.com/users/crumpx/following{/other_user}","gists_url":"https://api.github.com/users/crumpx/gists{/gist_id}","starred_url":"https://api.github.com/users/crumpx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crumpx/subscriptions","organizations_url":"https://api.github.com/users/crumpx/orgs","repos_url":"https://api.github.com/users/crumpx/repos","events_url":"https://api.github.com/users/crumpx/events{/privacy}","received_events_url":"https://api.github.com/users/crumpx/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T00:07:01Z","updated_at":"2015-05-28T00:07:01Z","body":"Thanks.\r\n\r\nI had an \"console.log\" left in mymodule.js by mistake when I was trying to debug this. \r\nit's now removed.\r\nbut that's not the cause of the original problem."}}