(key, value, options)
| 33218 | return encodeDeepObjectObject(key, value, options); |
| 33219 | } |
| 33220 | function encodeDeepObjectObject(key, value, options) { |
| 33221 | if (value == null) { |
| 33222 | return ""; |
| 33223 | } |
| 33224 | let out = ""; |
| 33225 | const encodeString = (v5) => { |
| 33226 | return (options === null || options === void 0 ? void 0 : options.charEncoding) === "percent" ? encodeURIComponent(v5) : v5; |
| 33227 | }; |
| 33228 | if (!(0, is_plain_object_js_1.isPlainObject)(value)) { |
| 33229 | throw new EncodingError(`Expected parameter '${key}' to be an object.`); |
| 33230 | } |
| 33231 | Object.entries(value).forEach(([ck, cv]) => { |
| 33232 | if (cv === void 0) { |
| 33233 | return; |
| 33234 | } |
| 33235 | const pk = `${key}[${ck}]`; |
| 33236 | if ((0, is_plain_object_js_1.isPlainObject)(cv)) { |
| 33237 | const objOut = encodeDeepObjectObject(pk, cv, options); |
| 33238 | out += `&${objOut}`; |
| 33239 | return; |
| 33240 | } |
| 33241 | const pairs = Array.isArray(cv) ? cv : [cv]; |
| 33242 | let encoded = ""; |
| 33243 | encoded = mapDefined(pairs, (v5) => { |
| 33244 | return `${encodeString(pk)}=${encodeString(serializeValue(v5))}`; |
| 33245 | }).join("&"); |
| 33246 | out += `&${encoded}`; |
| 33247 | }); |
| 33248 | return out.slice(1); |
| 33249 | } |
| 33250 | function encodeJSON(key, value, options) { |
| 33251 | if (typeof value === "undefined") { |
| 33252 | return ""; |
no test coverage detected
searching dependent graphs…