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

Projects
None yet
5 participants
@ndngo
Copy link
Contributor

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

This comment has been minimized.

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.

@trowacat
Copy link
Contributor

trowacat left a comment

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.

@jatinkumarg
Copy link
Contributor

jatinkumarg left a comment

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

jatinkumarg commented Jan 28, 2019

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

@humphd

humphd approved these changes Jan 31, 2019

Copy link
Contributor

humphd left a comment

Looks great.

@humphd humphd merged commit 4a39dcc into filerjs:master Jan 31, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.