function routeMatcher(paths) { const regexes = paths.map( (path) => path.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/") ); const regex = `^(?:${regexes.map((r) => `(?:${r})`).join("|")})[^/]*$`; return new RegExp(regex, "i"); } export { routeMatcher };