Skip to content

Commit

Permalink
fix: use system path separator in inferName regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mlrawlings committed Apr 10, 2020
1 parent 94e3c72 commit 576a159
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ export function defaultNormalizer(container: ContainerNode) {
return clone;
}

const sep = path.sep;
const nameRegex = new RegExp(`${sep}(([^${sep}]+)${sep}([^${sep}]+)\\.marko$)`);
function inferName(p: string) {
const match = /\/([^/]+)\/([^/]+)\.marko$/.exec(p)!;
const match = nameRegex.exec(p)!;
const indexOrTemplate = match[2] === "index" || match[2] === "template";
return indexOrTemplate ? match[1] : match[2];
}

0 comments on commit 576a159

Please sign in to comment.