I'm trying to validate if a string contains certain substrings defined inside an array:
const subStringElems= ['ELEM1', 'ELEM2', 'ELEM3', 'ELEM4'];
This is the code for the data validator:
const JoiValidator = require('@hapi/joi');
const subStringElems= ['ELEM1', 'ELEM2', 'ELEM3', 'ELEM4'];
let valSchema = {};
valSchema.manageDataParams = Joi.object().keys({
stringToBeValidated: Joi.string().required(),
(...)
});
Is there any way to check if "stringToBeValidated" contains all of these 4 elements other than using regex for this purpose?