Skip to content

Commit dc0e665

Browse files
committed
small optimization to remove need for looping
1 parent a815490 commit dc0e665

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/bundler-plugin-core/src/utils/normalizePath.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ export const normalizePath = (path: string, format: string): string => {
3030

3131
// grab the ending delimiter and create a regex group for it
3232
let endingDelimiter = "";
33-
[...format.slice(match.hashIndex)].forEach((char, index) => {
34-
if (char === "]") {
35-
endingDelimiter = format.at(match.hashIndex + index + 1) ?? "";
36-
}
37-
});
33+
34+
endingDelimiter =
35+
format.at(
36+
match.hashIndex + format.slice(match.hashIndex).indexOf("]") + 1,
37+
) ?? "";
3838

3939
// If the ending delimiter is `[extname]` there won't be a
4040
// `.<file-extension>` so we need to replace it with a `.` for the

0 commit comments

Comments
 (0)