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

Function resolveStrictStructuredField

http/unstable_message_signatures.ts:525–542  ·  view source on GitHub ↗
(
  headerValue: string,
  fieldName: string,
)

Source from the content-addressed store, hash-verified

523}
524
525function resolveStrictStructuredField(
526 headerValue: string,
527 fieldName: string,
528): string {
529 // Try Dictionary, then List, then Item — the first successful parse wins
530 try {
531 return serializeDictionary(parseDictionary(headerValue));
532 } catch { /* not a dictionary */ }
533 try {
534 return serializeList(parseList(headerValue));
535 } catch { /* not a list */ }
536 try {
537 return serializeItem(parseItem(headerValue));
538 } catch { /* not an item */ }
539 throw new TypeError(
540 `Cannot apply "sf" parameter to field "${fieldName}": unknown Structured Field type`,
541 );
542}
543
544function resolveDictionaryMember(
545 headerValue: string,

Callers 1

resolveFieldComponentFunction · 0.85

Calls 6

serializeDictionaryFunction · 0.90
parseDictionaryFunction · 0.90
serializeListFunction · 0.90
parseListFunction · 0.90
serializeItemFunction · 0.90
parseItemFunction · 0.90

Tested by

no test coverage detected