MCPcopy Create free account
hub / github.com/anomalyco/opencode / mergeStringRecords

Function mergeStringRecords

packages/llm/src/schema/options.ts:22–34  ·  view source on GitHub ↗
(
  ...items: ReadonlyArray<Record<string, string> | undefined>
)

Source from the content-addressed store, hash-verified

20}
21
22const mergeStringRecords = (
23 ...items: ReadonlyArray<Record<string, string> | undefined>
24): Record<string, string> | undefined => {
25 const defined = items.filter((item): item is Record<string, string> => item !== undefined)
26 if (defined.length === 0) return undefined
27 if (defined.length === 1) return defined[0]
28 const result = Object.fromEntries(
29 defined.flatMap((item) =>
30 Object.entries(item).filter((entry): entry is [string, string] => entry[1] !== undefined),
31 ),
32 )
33 return Object.keys(result).length === 0 ? undefined : result
34}
35
36export const ProviderOptions = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown))
37export type ProviderOptions = Schema.Schema.Type<typeof ProviderOptions>

Callers 1

mergeHttpOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected