one
Version:
One is a new React Framework that makes Vite serve both native and web.
22 lines (21 loc) • 586 B
JavaScript
const getParamName = (pattern) => pattern.replace(/^[:*]/, "").replace(/\?$/, "");
function getParamValue(p, value) {
if (p.startsWith("*")) {
const values = value.split("/").filter((v) => v !== "");
return values.length === 0 && p.endsWith("?") ? void 0 : values;
}
return value;
}
function isDynamicPart(p) {
return p.length > 1 && (p.startsWith(":") || p.startsWith("*"));
}
function replacePart(p) {
return p.replace(/^[:*]/, "").replace(/\?$/, "");
}
export {
getParamName,
getParamValue,
isDynamicPart,
replacePart
};
//# sourceMappingURL=_shared.js.map