MCPcopy Create free account
hub / github.com/Effect-TS/effect / toRecord

Function toRecord

packages/platform/src/UrlParams.ts:267–280  ·  view source on GitHub ↗
(self: UrlParams)

Source from the content-addressed store, hash-verified

265 * @category conversions
266 */
267export const toRecord = (self: UrlParams): Record<string, string | Arr.NonEmptyArray<string>> => {
268 const out: Record<string, string | Arr.NonEmptyArray<string>> = Object.create(null)
269 for (const [k, value] of self) {
270 const curr = out[k]
271 if (curr === undefined) {
272 out[k] = value
273 } else if (typeof curr === "string") {
274 out[k] = [curr, value]
275 } else {
276 curr.push(value)
277 }
278 }
279 return { ...out }
280}
281
282/**
283 * @since 1.0.0

Callers 2

schemaStructFunction · 0.70
decodeFunction · 0.70

Calls 1

createMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…