MCPcopy
hub / github.com/di-sukharev/opencommit / encodeDeepObjectObject

Function encodeDeepObjectObject

out/cli.cjs:33220–33249  ·  view source on GitHub ↗
(key, value, options)

Source from the content-addressed store, hash-verified

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 "";

Callers 1

encodeDeepObjectFunction · 0.85

Calls 6

mapDefinedFunction · 0.85
encodeStringFunction · 0.85
serializeValueFunction · 0.85
forEachMethod · 0.45
entriesMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…