(key: K, value: V, options?: {
readonly separator?: string | undefined
readonly keyValueSeparator?: string | undefined
})
| 1016 | * @since 4.0.0 |
| 1017 | */ |
| 1018 | export 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 | |
| 1036 | const ArrayConfig = <V extends Schema.Constraint>(value: V, options?: { |
| 1037 | readonly separator?: string | undefined |
nothing calls this directly
no test coverage detected