UNPKG

@oazapfts/runtime

Version:

Runtime for OpenApi TypeScript client generator

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