({ key, value }: {
key: Schema<KA, string, KR>
value: Schema<VA, VI, VR>
})
| 7751 | * @since 3.10.0 |
| 7752 | */ |
| 7753 | export const MapFromRecord = <KA, KR, VA, VI, VR>({ key, value }: { |
| 7754 | key: Schema<KA, string, KR> |
| 7755 | value: Schema<VA, VI, VR> |
| 7756 | }): SchemaClass<Map<KA, VA>, { readonly [x: string]: VI }, KR | VR> => |
| 7757 | transform( |
| 7758 | Record({ key: encodedBoundSchema(key), value }).annotations({ |
| 7759 | description: "a record to be decoded into a Map" |
| 7760 | }), |
| 7761 | MapFromSelf({ key, value: typeSchema(value) }), |
| 7762 | { |
| 7763 | strict: true, |
| 7764 | decode: (i) => new Map(Object.entries(i)), |
| 7765 | encode: (a) => Object.fromEntries(a) |
| 7766 | } |
| 7767 | ) |
| 7768 | |
| 7769 | const setArbitrary = |
| 7770 | <A>(item: LazyArbitrary<A>, ctx: ArbitraryGenerationContext): LazyArbitrary<ReadonlySet<A>> => (fc) => { |
nothing calls this directly
no test coverage detected
searching dependent graphs…