one
Version:
One is a React framework for web, iOS, and Android apps.
17 lines (14 loc) • 526 B
JavaScript
import { getPathnameFromFilePath } from "../../utils/getPathnameFromFilePath.mjs";
function getPathFromRoute(route, options = {}) {
const params = {};
for (const [param, inner] of route.file.matchAll(/\[([^\]]+)\]/g)) {
params[inner] = param;
params[inner.replace(/^\.\.\./, "")] = param;
}
return getPathnameFromFilePath(route.file, params, false, {
...options,
preserveExtensions: true
}).replace(/^\.\//, "/").replace(/\/+$/, "");
}
export { getPathFromRoute };
//# sourceMappingURL=getPathFromRoute.mjs.map