@sls-next/core
Version:
Handles Next.js routing independent of provider
14 lines (13 loc) • 514 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isOptionalCatchAllRoute = exports.isDynamicRoute = void 0;
const isDynamicRoute = (route) => {
// Identify /[param]/ in route string
return /\/\[[^\/]+?](?=\/|$)/.test(route);
};
exports.isDynamicRoute = isDynamicRoute;
const isOptionalCatchAllRoute = (route) => {
// Identify /[[param]]/ in route string
return /\/\[\[[^\/]+?]](?=\/|$)/.test(route);
};
exports.isOptionalCatchAllRoute = isOptionalCatchAllRoute;