Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

drbabol
Copy link

@drbabol drbabol commented Dec 27, 2022

No description provided.

const redacted = 'redacted.txt'

//function to read the content of the story
const readStory = story => {

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

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 = () => { .....

Copy link
Author

@drbabol drbabol Jan 23, 2023

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

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

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.

Copy link
Author

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

Copy link
Author

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

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