({ key, value }: {
key: Schema<KA, string, KR>
value: Schema<VA, VI, VR>
})
| 7731 | * @since 3.10.0 |
| 7732 | */ |
| 7733 | export const ReadonlyMapFromRecord = <KA, KR, VA, VI, VR>({ key, value }: { |
| 7734 | key: Schema<KA, string, KR> |
| 7735 | value: Schema<VA, VI, VR> |
| 7736 | }): SchemaClass<ReadonlyMap<KA, VA>, { readonly [x: string]: VI }, KR | VR> => |
| 7737 | transform( |
| 7738 | Record({ key: encodedBoundSchema(key), value }).annotations({ |
| 7739 | description: "a record to be decoded into a ReadonlyMap" |
| 7740 | }), |
| 7741 | ReadonlyMapFromSelf({ key, value: typeSchema(value) }), |
| 7742 | { |
| 7743 | strict: true, |
| 7744 | decode: (i) => new Map(Object.entries(i)), |
| 7745 | encode: (a) => Object.fromEntries(a) |
| 7746 | } |
| 7747 | ) |
| 7748 | |
| 7749 | /** |
| 7750 | * @category Map transformations |
nothing calls this directly
no test coverage detected