sunknudsen
sunknudsen

Reputation: 7290

How to check if string is valid by checking if its value is in array

joi.string().valid(['foo', 'bar']) has been deprecated.

Error: Method no longer accepts array arguments: allow

What is the new way of achieving this?

Upvotes: 3

Views: 709

Answers (1)

sunknudsen
sunknudsen

Reputation: 7290

Using spread syntax works perfectly!

joi.string().valid(...['foo', 'bar'])

Upvotes: 6

Related Questions