MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / encodeBodyForm

Function encodeBodyForm

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

Source from the content-addressed store, hash-verified

33182 exports2.encodeSpaceDelimited = formEncoder(" ");
33183 exports2.encodePipeDelimited = formEncoder("|");
33184 function encodeBodyForm(key, value, options) {
33185 let out = "";
33186 const pairs = (options === null || options === void 0 ? void 0 : options.explode) ? explode(key, value) : [[key, value]];
33187 const encodeString = (v5) => {
33188 return (options === null || options === void 0 ? void 0 : options.charEncoding) === "percent" ? encodeURIComponent(v5) : v5;
33189 };
33190 const encodeValue = (v5) => encodeString(serializeValue(v5));
33191 pairs.forEach(([pk, pv]) => {
33192 let tmp = "";
33193 let encValue = "";
33194 if (pv === void 0) {
33195 return;
33196 } else if (Array.isArray(pv)) {
33197 encValue = JSON.stringify(pv, jsonReplacer);
33198 } else if ((0, is_plain_object_js_1.isPlainObject)(pv)) {
33199 encValue = JSON.stringify(pv, jsonReplacer);
33200 } else {
33201 encValue = `${encodeValue(pv)}`;
33202 }
33203 tmp = `${encodeString(pk)}=${encValue}`;
33204 if (!tmp || tmp === "=") {
33205 return;
33206 }
33207 out += `&${tmp}`;
33208 });
33209 return out.slice(1);
33210 }
33211 function encodeDeepObject(key, value, options) {
33212 if (value == null) {
33213 return "";

Callers

nothing calls this directly

Calls 5

explodeFunction · 0.85
encodeValueFunction · 0.85
encodeStringFunction · 0.85
forEachMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…