one
Version:
One is a React framework for web, iOS, and Android apps.
18 lines (16 loc) • 571 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.mjs.map