Skip to content

Commit

Permalink
Update paths.js, rename shadow path variable (#4435)
Browse files Browse the repository at this point in the history
* Update paths.js, rename shadow path variable

This file requires the "path" module and sets it to a variable `path`. The function `ensureSlash` also has a variable `path` that then shadows the `path` module.

* Update paths.js
  • Loading branch information
Graeme authored and iansu committed May 23, 2018
1 parent 86a82b1 commit 61c864c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/react-scripts/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ const resolveApp = relativePath => path.resolve(appDirectory, relativePath);

const envPublicUrl = process.env.PUBLIC_URL;

function ensureSlash(path, needsSlash) {
const hasSlash = path.endsWith('/');
function ensureSlash(inputPath, needsSlash) {
const hasSlash = inputPath.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(0, path.length - 1);
return inputPath.substr(0, inputPath.length - 1);
} else if (!hasSlash && needsSlash) {
return `${path}/`;
return `${inputPath}/`;
} else {
return path;
return inputPath;
}
}

Expand Down

0 comments on commit 61c864c

Please sign in to comment.