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

Function fill

out/cli.cjs:58399–58423  ·  view source on GitHub ↗
(headers, object)

Source from the content-addressed store, hash-verified

58397 }
58398 function headerValueNormalize(potentialValue) {
58399 let i3 = 0;
58400 let j4 = potentialValue.length;
58401 while (j4 > i3 && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(j4 - 1))) --j4;
58402 while (j4 > i3 && isHTTPWhiteSpaceCharCode(potentialValue.charCodeAt(i3))) ++i3;
58403 return i3 === 0 && j4 === potentialValue.length ? potentialValue : potentialValue.substring(i3, j4);
58404 }
58405 function fill(headers, object) {
58406 if (Array.isArray(object)) {
58407 for (let i3 = 0; i3 < object.length; ++i3) {
58408 const header = object[i3];
58409 if (header.length !== 2) {
58410 throw webidl.errors.exception({
58411 header: "Headers constructor",
58412 message: `expected name/value pair to be length 2, found ${header.length}.`
58413 });
58414 }
58415 appendHeader(headers, header[0], header[1]);
58416 }
58417 } else if (typeof object === "object" && object !== null) {
58418 const keys = Object.keys(object);
58419 for (let i3 = 0; i3 < keys.length; ++i3) {
58420 appendHeader(headers, keys[i3], object[keys[i3]]);
58421 }
58422 } else {
58423 throw webidl.errors.conversionFailed({
58424 prefix: "Headers constructor",
58425 argument: "Argument 1",
58426 types: ["sequence<sequence<ByteString>>", "record<ByteString, ByteString>"]

Callers 2

constructorMethod · 0.85
initializeResponseFunction · 0.85

Calls 2

appendHeaderFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…