fix(striker-ui): add yup dynamic object builder

main
Tsu-ba-me 1 year ago
parent 990dfbb375
commit 2e2450b8b9
  1. 14
      striker-ui/lib/buildYupDynamicObject.ts

@ -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…
Cancel
Save