Skip to content
Permalink
Browse files

path: improve normalization performance

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 3, 2019
1 parent 02a50c3 commit 1f82929ed070c68855af8d93d6862ac7f860e773
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/path.js
@@ -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;

0 comments on commit 1f82929

Please sign in to comment.
You can’t perform that action at this time.