UNPKG

@oazapfts/runtime

Version:

Runtime for OpenApi TypeScript client generator

36 lines (35 loc) 1.16 kB
const a = [encodeURIComponent, encodeURIComponent], m = [encodeURIComponent, encodeURI], s = [ encodeURIComponent, p ]; function d(e, t = ",") { const o = (n, r) => { const c = e[r % e.length]; return typeof n > "u" ? "" : typeof n == "object" ? Array.isArray(n) ? n.map(c).join(t) : Object.entries(n).reduce( (i, f) => [...i, ...f], [] ).map(c).join(t) : c(l(n)); }; return (n, ...r) => n.reduce((c, u, i) => `${c}${u}${o(r[i], i)}`, ""); } function R(e = ",") { return (t, o = a) => Object.entries(t).filter(([, n]) => n !== void 0).map(([n, r]) => d(o, e)`${n}=${r}`).join("&"); } function j(...e) { return e.filter(Boolean).map((t, o) => o === 0 ? t : t.replace(/^\/+/, "")).map((t, o, n) => o === n.length - 1 ? t : t.replace(/\/+$/, "")).join("/"); } function l(e) { return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : String(e); } function p(e) { return e === !0 ? "1" : e === !1 ? "0" : encodeURIComponent(e); } export { m as allowReserved, R as delimited, d as encode, a as encodeReserved, j as joinUrl, s as numericBooleanReserved }; //# sourceMappingURL=util.js.map