MCPcopy
hub / github.com/Effect-TS/effect / ReadonlyMap

Function ReadonlyMap

packages/effect/src/Schema.ts:7682–7695  ·  view source on GitHub ↗
({ key, value }: {
  readonly key: K
  readonly value: V
})

Source from the content-addressed store, hash-verified

7680 * @since 3.10.0
7681 */
7682export function ReadonlyMap<K extends Schema.Any, V extends Schema.Any>({ key, value }: {
7683 readonly key: K
7684 readonly value: V
7685}): ReadonlyMap$<K, V> {
7686 return transform(
7687 Array$(Tuple(key, value)),
7688 ReadonlyMapFromSelf({ key: typeSchema(asSchema(key)), value: typeSchema(asSchema(value)) }),
7689 {
7690 strict: true,
7691 decode: (i) => new Map(i),
7692 encode: (a) => Array.from(a.entries())
7693 }
7694 )
7695}
7696
7697/**
7698 * @category api interface

Callers

nothing calls this directly

Calls 7

typeSchemaFunction · 0.85
asSchemaFunction · 0.85
entriesMethod · 0.80
transformInterface · 0.70
Array$Function · 0.70
TupleFunction · 0.70
ReadonlyMapFromSelfFunction · 0.70

Tested by

no test coverage detected