Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learnyounode MAKE IT MODULAR sixth exercise problem. #2692

Open
PlutoA713N opened this issue Aug 12, 2023 · 0 comments
Open

learnyounode MAKE IT MODULAR sixth exercise problem. #2692

PlutoA713N opened this issue Aug 12, 2023 · 0 comments

Comments

@PlutoA713N
Copy link

learnyounode MAKE IT MODULAR sixth exercise problem.

  • node version: v18.17.0
  • npm version: 9.8.1
  • os: windows 11

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant