Skip to content

Conversation

starkwang
Copy link
Contributor

@starkwang starkwang commented Feb 6, 2018

There are many duplicated codes in methods such as normalizeString, format, extname and basename.

This change is to reduce them.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

path

@nodejs-github-bot nodejs-github-bot added the path Issues and PRs related to the path subsystem. label Feb 6, 2018
@starkwang
Copy link
Contributor Author

There are many duplicated codes in methods such as
`normalizeString`, `format`, `extname` and `basename`.
This change is to reduce them.
var lastSlash = -1;
var dots = 0;
var code;
var slashChar = win32 ? '\\' : '/';
Copy link
Contributor

Choose a reason for hiding this comment

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

we can use const here


function _extname(path, win32) {
assertPath(path);
var start = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use let/const instead of var in places where in possible

@starkwang
Copy link
Contributor Author

This PR will be rebased after another PR (#18654) lands.

@BridgeAR
Copy link
Member

This needs a rebase.

@starkwang
Copy link
Contributor Author

This PR is out of date and hard to rebase. I'll open another PR.

@starkwang starkwang closed this Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

path Issues and PRs related to the path subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants