Merge pull request #2014 from dolanmiu/feat/regex-match-for-types-fixer

Add fix to allow for different types of slash to be supported
This commit is contained in:
Dolan
2023-03-18 23:46:25 +00:00
committed by GitHub

View File

@ -9,7 +9,7 @@ for (const file of files) {
from: /"@[a-z/-]*"/gi, from: /"@[a-z/-]*"/gi,
to: (match) => { to: (match) => {
const matchSlug = match.replace(/['"]+/g, "").replace(/[@]+/g, "").trim(); const matchSlug = match.replace(/['"]+/g, "").replace(/[@]+/g, "").trim();
const levelCount = file.split("/").length - 2; const levelCount = file.split(/[\/\\]/).length - 2;
const backLevels = Array(levelCount).fill("../").join(""); const backLevels = Array(levelCount).fill("../").join("");
return `"${backLevels}${matchSlug}"`; return `"${backLevels}${matchSlug}"`;