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

feat: create a JS helpers class #190

Merged
merged 3 commits into from
Apr 16, 2024
Merged

Conversation

a2937
Copy link
Member

@a2937 a2937 commented Apr 8, 2024

Checklist:

Closes #XXXXX

In my opinion, it does come up fairly often that we use regex to ensure that variables are actually present in functions with default values; and I think the potential spacing issues aren't generally worth with it when we can just manually extract them.

I also tried to do some house-keeping and hopefully keep eslint from reformatting the fixtures as it is very space sensitive. As I use Visual Studio to edit Typescript, I also added some of the contents of VisualStudio.gitignore to the local gitignore. I will be be happy to remove the unrelated content and discuss them at a later date.

@a2937 a2937 requested a review from a team as a code owner April 8, 2024 18:43
Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first thing that stands out is that this would break for valid single-parameter syntax:

const myFunc = name => console.log("Name");

.gitignore Outdated Show resolved Hide resolved
@a2937 a2937 requested a review from naomi-lgbt April 8, 2024 23:24
@a2937
Copy link
Member Author

a2937 commented Apr 8, 2024

Did I get it, as all tests seem to pass?

Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @a2937, thanks for putting this together. The code looks like it does the job well, thanks. The only issue is that it's a little hard to read, so I made some suggestions for how that could be improved:

lib/index.ts Outdated Show resolved Hide resolved
lib/index.ts Outdated Show resolved Hide resolved
lib/__fixtures__/curriculum-helpers-javascript.ts Outdated Show resolved Hide resolved
lib/__tests__/javascript-helper.test.ts Outdated Show resolved Hide resolved
lib/index.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ojeytonwilliams ojeytonwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thanks @a2937!

@naomi-lgbt If you're happy, merge away.

Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it

@naomi-lgbt naomi-lgbt merged commit d0db232 into freeCodeCamp:main Apr 16, 2024
4 checks passed
@a2937 a2937 deleted the feat/js-helpers branch April 16, 2024 16:42
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.

3 participants