sparkletown/sparkle

View on GitHub
src/forms/questionSchema.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import * as Yup from "yup";

import { Question } from "types/Question";

export const questionSchema = Yup.array<Question>()
  .ensure()
  .defined()
  .transform((value) =>
    value.filter(({ name, text }: Question) => !!name && !!text)
  );