Javascript – Joi validate a string based on empty or non-empty values
I have the below Joi validation for a field called store_type store_type: Joi.string().valid(...Object.values(storeTypes)) .error(() => ({ message: `Store Type must be one of: ${Object.values(storeTypes).join(', ')}`, })).default(storeTypes.aaa), wherein storeTypes is defined as storeTypes: { aaa: 'AAA', bbb: 'BBB' } As per…