nodeschool / discussions

:school::speech_balloon: need help with nodeschool? or just wanna ask a question? open an issue on this repo!
488 stars 107 forks source link

learnyounode MAKE IT MODULAR sixth exercise problem. #2692

Open PlutoA713N opened 1 year ago

PlutoA713N commented 1 year ago

learnyounode MAKE IT MODULAR sixth exercise problem.

Error output

CHANDU@LAPTOP-EH32AU0E MINGW64 ~/node-classes
$ cd learnyounode

CHANDU@LAPTOP-EH32AU0E MINGW64 ~/node-classes/learnyounode
$ learnyounode verify make-it-modular.js

# LEARN YOU THE NODE.JS FOR MUCH WIN!

## MAKE IT MODULAR (Exercise 6 of 13)

Your submission results compared to the expected:

                 ACTUAL                                 EXPECTED    

────────────────────────────────────────────────────────────────────────────────

   "CHANGELOG.md"                      ==    "CHANGELOG.md"         

   "LICENCE.md"                        ==    "LICENCE.md"           

   "README.md"                         ==    "README.md"            

   ""                                  ==    ""                     

────────────────────────────────────────────────────────────────────────────────

 ✓ 

 Submission results match expected

 ✓ 

 Additional module file exports a single function

 ✓ 

 Additional module file exports a function that takes 3 arguments   

 ✓ 

 Additional module file handles errors properly

 ✓ 

 Additional module file handles callback argument

C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\node_modules\workshopper-exercise\exercise.js:170
    processors[i].call(self, mode, function (err, pass) {
                  ^

TypeError: Cannot read properties of undefined (reading 'call')     
    at next (C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\node_modules\workshopper-exercise\exercise.js:170:19)        
    at C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\node_modules\workshopper-exercise\exercise.js:175:7
    at callback (C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\exercises\make_it_modular\verify.js:26:15)
    at modFileError (C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\exercises\make_it_modular\verify.js:31:5)
    at C:\Users\CHANDU\AppData\Roaming\npm\node_modules\learnyounode\exercises\make_it_modular\verify.js:131:18
    at C:\Users\CHANDU\node-classes\learnyounode\my-module.js:11:13 
    at Array.forEach (<anonymous>)
    at C:\Users\CHANDU\node-classes\learnyounode\my-module.js:9:10  
    at FSReqCallback.oncomplete (node:fs:200:23)

Node.js v18.17.0

My Code

`my-module.js

const fs = require('fs');
const path = require('path');

const filesManager = (folder, extn, callback) => {
fs.readdir( folder, (err, data) => {
    if (err) {
        return callback( err );
    }
    data.forEach(file => {
        if (path.extname(file) == '.' + extn) { // We can alsoo use file.endsWith('.' + extn
            callback(null, file);
        }
    });
});
};

module.exports = filesManager;
`
 `make-it-modular.js

const filesManager = require('./my-module');

const callback = (err, data) => {
    if (err) {
        return console.error('Error message:', err);
    }
    console.log( data );
};

filesManager( process.argv[2], process.argv[3], callback);`

This is my first issue which i opened on github, my apologies if i made any mistake.

Hello Everyone, need help, My code passed all the test cases, but there's an internal error which is stopping to mark it as complete. could anyone tell me how to fix this issue. Thank You in advance.