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