Does Yup
have a built-in check for validating a string against an array of allowed values, or do I need to create my own test function for that?
const fruit = 'apple';
const allowedFruits = ['orange', 'cherry'];
// I need to verify if the fruit is one of the allowedFruits. The fruit value comes from user input.
Update:
I want to clarify that this question pertains to the Yup
validation library specifically, not how to achieve it in plain JavaScript.