-
Notifications
You must be signed in to change notification settings - Fork 26
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
Solution/diana calderon #11
base: master
Are you sure you want to change the base?
Conversation
function solution() { | ||
// YOUR SOLUTION GOES HERE | ||
|
||
// you get your 5 names here | ||
|
||
const vars = process.argv.slice(2).length ? [...process.argv.slice(2)] : ['John', 'Diana', 'Jose', 'Stacy', 'Mary']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would recommend assigning the terminal arguments to a variable so it has a clear name and you don't have to repeat it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are going to handle the case of comma separated arguments. I would handle it here as well. So that way your constant vars
is an array of strings. This will clean up a lot of the code below. You can handle it with a nested turnery or a let
variable with a if/else block underneath that will assign it
success.push(data); | ||
} | ||
|
||
counter++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to keep track of a count here. Would probably just push the success data like you are, then log the array
} | ||
|
||
// iterate the names array and validate them with the method | ||
const callbackPromisify = promisify(callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to use this somewhere?
|
||
counter++; | ||
// log the final result | ||
if(counter === names.length){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just log the array. It doesn't seem very valuable to add all this logic to get the output exactly like the example
return validateNames(lastname); | ||
}) | ||
.then( firstnameResult => { | ||
firstname = firstnameResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you return a promise here with the firstName so you don't have to assign it but instead pass it to the finally?
No description provided.