I found that every once in a while the program crashes on a undefined submittedUser in submittedUsers.
I used the following solution
function checkUsersValid(goodUsers) {
return function allUsersValid(submittedUsers) {
const result = submittedUsers.every(function (submittedUser) {
const result = goodUsers.some(function(goodUser) {
return submittedUser.id === goodUser.id;
});
return result;
});
return result;
};
}
module.exports = checkUsersValid
which resulted in this error
/Users/tjeerd/Development/nodeschool/program.js:11
return submittedUser.id === goodUser.id;
^
TypeError: Cannot read property 'id' of undefined
at /Users/tjeerd/Development/nodeschool/program.js:11:29
at Array.some (<anonymous>)
at /Users/tjeerd/Development/nodeschool/program.js:8:32
at Array.every (<anonymous>)
at allUsersValid (/Users/tjeerd/Development/nodeschool/program.js:6:35)
at /usr/local/lib/node_modules/functional-javascript-workshop/exercises/basic_every_some/exercise.js:35:5
at Array.forEach (<anonymous>)
at /usr/local/lib/node_modules/functional-javascript-workshop/exercises/basic_every_some/exercise.js:34:9
at obtainResult (/usr/local/lib/node_modules/functional-javascript-workshop/exercises/runner.js:100:21)
at Exercise.<anonymous> (/usr/local/lib/node_modules/functional-javascript-workshop/exercises/runner.js:66:27)
Using node version v8.6.0 and functional-javascript-workshop@1.0.6
I found that every once in a while the program crashes on a undefined submittedUser in submittedUsers.
I used the following solution
which resulted in this error
Using node version v8.6.0 and functional-javascript-workshop@1.0.6