parent
990dfbb375
commit
2e2450b8b9
1 changed files with 14 additions and 0 deletions
@ -0,0 +1,14 @@ |
||||
const buildYupDynamicObject = <S>( |
||||
obj: Record<string, S> | undefined, |
||||
schema: S, |
||||
): Record<string, S> | undefined => |
||||
obj && |
||||
Object.keys(obj).reduce<Record<string, S>>( |
||||
(previous, key) => ({ |
||||
...previous, |
||||
[key]: schema, |
||||
}), |
||||
{}, |
||||
); |
||||
|
||||
export default buildYupDynamicObject; |
Loading…
Reference in new issue