enum
enum(...values)
Effect
Restrict the detected string to be one of values
.
Arguments
...values
(Array<string>) - The valid values that allow the detected string to be.
Example
const schema = racoon.string().enum('a', 'b', 'c');
schema.validate('a'); // pass
schema.validate('b'); // pass
schema.validate('c'); // pass
schema.validate('d'); // fail
Last updated
Was this helpful?