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 ZYSzys committed Aug 3, 2019
1 parent e3f4ec9 commit 37d27486fce50bd82b6b5095af880d435ed308f8
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 37d2748

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