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

Fixes Issue#674: Refactored var declarations to const or let declarations to address i… #676

Merged
merged 2 commits into from
Jan 31, 2019

Conversation

ndngo
Copy link
Contributor

@ndngo ndngo commented Jan 25, 2019

…issue#674

Added the 'use strict' declaration at the top and refactored var variable declarations to use const or let.

@codecov-io
Copy link

codecov-io commented Jan 25, 2019

Codecov Report

Merging #676 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #676   +/-   ##
=======================================
  Coverage   86.71%   86.71%           
=======================================
  Files          16       16           
  Lines        1746     1746           
=======================================
  Hits         1514     1514           
  Misses        232      232

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26b47ee...8d8e54d. Read the comment docs.

Copy link
Contributor

@trowacat trowacat left a comment

Choose a reason for hiding this comment

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

Good initiative ndngo, I am wondering if it would be best to make more use of const in the file however. I notice a lot of use of let when the function is not actually changing any values. It might be best in such cases to use const instead.

Copy link
Contributor

@jatinkumarg jatinkumarg left a comment

Choose a reason for hiding this comment

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

I think 'let' will be fine as there are multiple declarations of variables with the same name. By using let as the data type for "fs" and "fsPromise" will make them block-scoped. Check out this link.

@humphd
Copy link
Contributor

humphd commented Jan 27, 2019

Agree that const is best when the variable won't change values (e.g., fs will always be the same thing within each test scope). Save let for cases where it will change.

@ndngo ndngo changed the title Refactored var declarations to const or let declarations to address i… Fixes Issue#674: Refactored var declarations to const or let declarations to address i… Jan 28, 2019
@ndngo
Copy link
Contributor Author

ndngo commented Jan 28, 2019

That makes sense. I have changed variables that don't change values to be declared with const.

@jatinkumarg
Copy link
Contributor

Thanks for the clarification, I have also changed the code to use const in the fs.readdir.spec.js file.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

Looks great.

@humphd humphd merged commit 4a39dcc into filerjs:master Jan 31, 2019
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.

5 participants