-
Notifications
You must be signed in to change notification settings - Fork 131
feat(m4): solution exe 013 #2526
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
base: main
Are you sure you want to change the base?
feat(m4): solution exe 013 #2526
Conversation
const redacted = 'redacted.txt' | ||
|
||
//function to read the content of the story | ||
const readStory = story => { |
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.
story -> global scope ;-)
const readStory = () => { .....
} | ||
|
||
// function to read the content of sesitive words | ||
const readSensitive = sensitive => { |
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.
sensitive -> global scope ;-)
const readSensitive = () => { .....
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.
why? it's just in this exercise, because I don't call the fucntion?
return text | ||
} | ||
|
||
Promise.all([readStory(story), readSensitive(sensitive)]) |
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.
Promise.all( [ readStory(), readSensitive() ] )
}) | ||
.catch((error) => { | ||
if (error.code === 'ENOENT') { | ||
console.error(`${redacted} file does not exist`) |
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.
Try renaming sensitive words -> sensitive_words.
Check if the problem prints correctly.
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 see the problem, I will try to fix it by adding a function to read the redacted file and add it to the Promise.all()
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.
Maybe I can optimize the code buy writing only one function to read files and called it 3 times in the Promise.all...
Working in Progress
No description provided.