MCPcopy Create free account
hub / github.com/denoland/std / serializeDictionary

Function serializeDictionary

http/unstable_structured_fields.ts:1197–1218  ·  view source on GitHub ↗
(dict: Dictionary)

Source from the content-addressed store, hash-verified

1195 * ```
1196 */
1197export function serializeDictionary(dict: Dictionary): string {
1198 const parts: string[] = [];
1199
1200 for (const [key, member] of dict) {
1201 validateKey(key);
1202
1203 if ("items" in member) {
1204 // Inner list
1205 parts.push(`${key}=${serializeInnerList(member)}`);
1206 } else {
1207 // Item
1208 if (member.value.type === "boolean" && member.value.value === true) {
1209 // Omit =?1 for true boolean
1210 parts.push(key + serializeParameters(member.parameters));
1211 } else {
1212 parts.push(`${key}=${serializeItemInternal(member)}`);
1213 }
1214 }
1215 }
1216
1217 return parts.join(", ");
1218}
1219
1220/**
1221 * Serializes an Item to a string.

Callers 4

signMessageFunction · 0.90
fnFunction · 0.90
runConformanceTestsFunction · 0.90

Calls 5

validateKeyFunction · 0.85
serializeInnerListFunction · 0.85
serializeParametersFunction · 0.85
serializeItemInternalFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected