Checks if one of the assertions passes.
If none of them passes it throws an error.
If you have two or three assertions consider using or2 or or3 respectively.
const trueish = or([literal(1), literal(true), literal("true"), literal("yes")]);trueish("yassss"); // Error: literaltrueish(1); // passestrueish(true); // passestrueish("true"); // passestrueish("yes"); // passes Copy
const trueish = or([literal(1), literal(true), literal("true"), literal("yes")]);trueish("yassss"); // Error: literaltrueish(1); // passestrueish(true); // passestrueish("true"); // passestrueish("yes"); // passes
Array of assertions to be checked
Checks if one of the assertions passes.
If none of them passes it throws an error.
If you have two or three assertions consider using or2 or or3 respectively.
Example