Skip to content

Commit

Permalink
path: improve normalization performance
Browse files Browse the repository at this point in the history
PR-URL: #28948
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information
mscdex authored and BridgeAR committed Aug 6, 2019
1 parent 02a50c3 commit 1f82929
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/path.js
Expand Up @@ -95,7 +95,10 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
lastSegmentLength = 2;
}
} else {
res += (res.length > 0 ? separator : '') + path.slice(lastSlash + 1, i);
if (res.length > 0)
res += `${separator}${path.slice(lastSlash + 1, i)}`;
else
res = path.slice(lastSlash + 1, i);
lastSegmentLength = i - lastSlash - 1;
}
lastSlash = i;
Expand Down

0 comments on commit 1f82929

Please sign in to comment.