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

Solution/diana calderon #11

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

DianaCalx
Copy link

No description provided.

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'];

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

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++;

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)

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){

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;

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?

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

Successfully merging this pull request may close these issues.

2 participants