| 1034 | } |
| 1035 | |
| 1036 | const ArrayConfig = <V extends Schema.Constraint>(value: V, options?: { |
| 1037 | readonly separator?: string | undefined |
| 1038 | }) => { |
| 1039 | const array = Schema.Array(value) |
| 1040 | const separator = options?.separator ?? "," |
| 1041 | const arrayString = Schema.String.pipe( |
| 1042 | Schema.decodeTo(Schema.toCodecStringTree(array), { |
| 1043 | decode: SchemaGetter.split(options), |
| 1044 | encode: SchemaGetter.passthrough<ReadonlyArray<string>, Schema.StringTree>({ strict: false }).compose( |
| 1045 | SchemaGetter.transform((input) => input.join(separator)) |
| 1046 | ) |
| 1047 | }) |
| 1048 | ) |
| 1049 | |
| 1050 | return Schema.Union([arrayString, array]) |
| 1051 | } |
| 1052 | |
| 1053 | export { |
| 1054 | /** |