@oazapfts/runtime
Version:
Runtime for OpenApi TypeScript client generator
37 lines (36 loc) • 1.2 kB
JavaScript
import { encodeReserved as d, delimited as p, encode as f } from "./util.js";
import { numericBooleanReserved as k } from "./util.js";
function q(...r) {
const n = r.filter(Boolean).join("&");
return n && `?${n}`;
}
function b(r, [n, o] = d) {
const t = f([(c) => String(c), n]), e = f([(c) => String(c), o]), i = (c, $ = "") => Object.entries(c).filter(([, s]) => s !== void 0).map(([s, u]) => {
const m = Array.isArray(c) ? "" : s, j = $ ? t`${$}[${m}]` : s;
return typeof u == "object" ? i(u, j) : e`${j}=${u}`;
}).join("&");
return i(r);
}
function y(r, n = d) {
const o = f(n);
return Object.entries(r).filter(([, t]) => t !== void 0).map(([t, e]) => Array.isArray(e) ? e.map((i) => o`${t}=${i}`).join("&") : typeof e == "object" ? y(e, n) : o`${t}=${e}`).join("&");
}
function l(r, n = d) {
const o = f(n);
return Object.entries(r).filter(([, t]) => t !== void 0).map(([t, e]) => {
const i = JSON.stringify(e);
return o`${t}=${i}`;
}).join("&");
}
const A = p(), O = p("|"), g = p("%20");
export {
b as deep,
y as explode,
A as form,
l as json,
k as numericBooleanReserved,
O as pipe,
q as query,
g as space
};
//# sourceMappingURL=query.js.map