( key: K, value: V, pathOrOptions?: string | Path | RecordOptions, options?: RecordOptions )
| 1268 | options?: RecordOptions |
| 1269 | ): Config<Schema.Record.Type<K, V>> |
| 1270 | export function Record< |
| 1271 | K extends Schema.Record.Key & Schema.ConstraintCodec<unknown, unknown>, |
| 1272 | V extends Schema.ConstraintCodec<unknown, unknown> |
| 1273 | >( |
| 1274 | key: K, |
| 1275 | value: V, |
| 1276 | pathOrOptions?: string | Path | RecordOptions, |
| 1277 | options?: RecordOptions |
| 1278 | ) { |
| 1279 | const hasPath = isPath(pathOrOptions) |
| 1280 | const record = Schema.Record(key, value) |
| 1281 | const split = SchemaTransformation.splitKeyValue(hasPath ? options : pathOrOptions) |
| 1282 | const recordString = Schema.String.pipe( |
| 1283 | Schema.decodeTo(Schema.toCodecStringTree(record), { |
| 1284 | decode: split.decode, |
| 1285 | encode: SchemaGetter.compose( |
| 1286 | SchemaGetter.passthrough<Record<string, string>, Schema.StringTree>({ strict: false }), |
| 1287 | split.encode |
| 1288 | ) |
| 1289 | }) |
| 1290 | ) |
| 1291 | return schema(Schema.Union([record, recordString]), hasPath ? pathOrOptions : undefined) |
| 1292 | } |
| 1293 | |
| 1294 | /** |
| 1295 | * Creates a config for a boolean value parsed from common string |
nothing calls this directly
no test coverage detected