{"action":"created","issue":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/1470","labels_url":"https://api.github.com/repos/nodeschool/discussions/issues/1470/labels{/name}","comments_url":"https://api.github.com/repos/nodeschool/discussions/issues/1470/comments","events_url":"https://api.github.com/repos/nodeschool/discussions/issues/1470/events","html_url":"https://github.com/nodeschool/discussions/issues/1470","id":109376695,"number":1470,"title":"Make it modular","user":{"login":"SigmaEva","id":14931386,"avatar_url":"https://avatars.githubusercontent.com/u/14931386?v=3","gravatar_id":"","url":"https://api.github.com/users/SigmaEva","html_url":"https://github.com/SigmaEva","followers_url":"https://api.github.com/users/SigmaEva/followers","following_url":"https://api.github.com/users/SigmaEva/following{/other_user}","gists_url":"https://api.github.com/users/SigmaEva/gists{/gist_id}","starred_url":"https://api.github.com/users/SigmaEva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SigmaEva/subscriptions","organizations_url":"https://api.github.com/users/SigmaEva/orgs","repos_url":"https://api.github.com/users/SigmaEva/repos","events_url":"https://api.github.com/users/SigmaEva/events{/privacy}","received_events_url":"https://api.github.com/users/SigmaEva/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodeschool/discussions/labels/learnyounode","name":"learnyounode","color":"F0A028"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-01T20:27:06Z","updated_at":"2015-10-07T04:17:01Z","closed_at":null,"body":"Hey all,\r\ni am getting a fail in learnyounode - make it modular.\r\nThese are my results : \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✓ Additional module file handles errors properly\r\n✓ Additional module file handles callback argument\r\n✓ Additional module file returned two arguments on the callback function\r\n✗ Your additional module file [mymodule.js] did not return an Array object as the second argument of the callback\r\n✓ Additional module file returned two arguments on the callback function\r\n✗ Your additional module file [mymodule.js] did not return an Array object as the second argument of the callback\r\n/usr/local/lib/node_modules/learnyounode/node_modules/workshopper-exercise/exercise.js:177\r\n    processors[i].call(self, mode, function (err, pass) {\r\n                  ^\r\nTypeError: Cannot call method 'call' of undefined\r\n\r\nAnd this is my code : \r\n\r\n```\r\nvar mymodule = require('./mymodule.js');\r\nvar path = require('path');\r\n\r\nmymodule(process.argv[2],process.argv[3],function(err,data){\r\n\tif(err)throw err;\r\n\t\tconsole.log(data);\t\r\n});\r\n```\r\nand the mymodule file\r\n\r\n```\r\nvar path = require('path');\r\nvar fs = require('fs');\r\n\r\nmodule.exports = function(directory,extention,callback){\r\n\tfs.readdir(directory, function (err, list) {\r\n\t\tif(err){\r\n\t\t\treturn callback(err);\r\n\t\t}\r\n      \tlist.forEach(function (data) {\r\n        \tif (path.extname(data) === '.' + extention){\r\n        \t\treturn callback(null,data);\r\n        \t}\r\n      \t})\r\n  \t\t\r\n    })\r\n}\r\n```\r\n\r\nthanx in advnce :)\r\n"},"comment":{"url":"https://api.github.com/repos/nodeschool/discussions/issues/comments/146073572","html_url":"https://github.com/nodeschool/discussions/issues/1470#issuecomment-146073572","issue_url":"https://api.github.com/repos/nodeschool/discussions/issues/1470","id":146073572,"user":{"login":"wuyun1","id":12711404,"avatar_url":"https://avatars.githubusercontent.com/u/12711404?v=3","gravatar_id":"","url":"https://api.github.com/users/wuyun1","html_url":"https://github.com/wuyun1","followers_url":"https://api.github.com/users/wuyun1/followers","following_url":"https://api.github.com/users/wuyun1/following{/other_user}","gists_url":"https://api.github.com/users/wuyun1/gists{/gist_id}","starred_url":"https://api.github.com/users/wuyun1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wuyun1/subscriptions","organizations_url":"https://api.github.com/users/wuyun1/orgs","repos_url":"https://api.github.com/users/wuyun1/repos","events_url":"https://api.github.com/users/wuyun1/events{/privacy}","received_events_url":"https://api.github.com/users/wuyun1/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T04:17:01Z","updated_at":"2015-10-07T04:17:01Z","body":" code file:\r\n```javascript\r\nvar mymodule = require('./mymodule.js');\r\nvar path = require('path');\r\n\r\nmymodule(process.argv[2],process.argv[3],function(err,list){\r\n    if(err)throw err;\r\n        console.log(list.join(\"\\n\"));  \r\n});\r\n```\r\n\r\n module file:\r\n```javascript\r\nvar path = require('path');\r\nvar fs = require('fs');\r\n\r\nmodule.exports = function(directory,extention,callback){\r\n    fs.readdir(directory, function (err, list) {\r\n        if(err){\r\n            return callback(err);\r\n        }\r\n        var  filter_list=[];\r\n        list.forEach(function (data) {\r\n            if (path.extname(data) === '.' + extention){\r\n                filter_list.push(data);\r\n            }\r\n        })\r\n        return callback(null,filter_list);\r\n    })\r\n}\r\n```"}}