Validate an input is one of a list of options
The validated type
The valid options
isOneOf([1, 2, 3])(1) >> { valid: true, parsed: 1, }; isOneOf([1, 2, 3])(4) >> { valid: false, error: "Not one of [1, 2, 3]: 4", }; Copy
isOneOf([1, 2, 3])(1) >> { valid: true, parsed: 1, }; isOneOf([1, 2, 3])(4) >> { valid: false, error: "Not one of [1, 2, 3]: 4", };
Validate an input is one of a list of options