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

Function Record

packages/effect/src/Config.ts:1018–1034  ·  view source on GitHub ↗
(key: K, value: V, options?: {
  readonly separator?: string | undefined
  readonly keyValueSeparator?: string | undefined
})

Source from the content-addressed store, hash-verified

1016 * @since 4.0.0
1017 */
1018export const Record = <K extends Schema.Record.Key, V extends Schema.Constraint>(key: K, value: V, options?: {
1019 readonly separator?: string | undefined
1020 readonly keyValueSeparator?: string | undefined
1021}) => {
1022 const record = Schema.Record(key, value)
1023 const split = SchemaTransformation.splitKeyValue(options)
1024 const recordString = Schema.String.pipe(
1025 Schema.decodeTo(Schema.toCodecStringTree(record), {
1026 decode: split.decode,
1027 encode: SchemaGetter.passthrough<Record<string, string>, Schema.StringTree>({ strict: false }).compose(
1028 split.encode
1029 )
1030 })
1031 )
1032
1033 return Schema.Union([record, recordString])
1034}
1035
1036const ArrayConfig = <V extends Schema.Constraint>(value: V, options?: {
1037 readonly separator?: string | undefined

Callers

nothing calls this directly

Calls 3

pipeMethod · 0.65
composeMethod · 0.65
toCodecStringTreeMethod · 0.45

Tested by

no test coverage detected