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

Function toCodec

packages/effect/src/encoding/Csv.ts:608–616  ·  view source on GitHub ↗
(schema: S, disableCodecs: boolean | undefined)

Source from the content-addressed store, hash-verified

606// The schema used for CSV cells. `toCodecStringTree` keeps the decoded type and
607// services and only changes the encoded side, which is treated as unknown here.
608const toCodec = <S extends Schema.Constraint>(schema: S, disableCodecs: boolean | undefined): S => {
609 if (disableCodecs === true) return schema
610 let codec = stringTreeCodecs.get(schema)
611 if (codec === undefined) {
612 codec = Schema.toCodecStringTree(schema)
613 stringTreeCodecs.set(schema, codec)
614 }
615 return codec as S
616}
617
618const toArrayCodec = <S extends Schema.Constraint>(codec: S): Schema.NonEmptyArray<S> => {
619 let array = arrayCodecs.get(codec)

Callers 3

decodeSchemaStringFunction · 0.70
encodeSchemaRecordsFunction · 0.70
toCodec.test.tsFile · 0.50

Calls 3

getMethod · 0.65
toCodecStringTreeMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected