validateAllArgsBoolean
Description
It resolves the list of args if they are booleans. If there is at least one item from the list that is not a boolean type, this function will throw.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<Array<boolean>> | |
Related Functions | Function Signature | |
function validateAllArgsBoolean(...everything): Promise<Array<boolean>> |
Examples
1
2
3
4
5
import { validateAllArgsBoolean } from "puddy-m/lib/validators/complexValidators";
validateAllArgsBoolean(true, false, true).then((booleanArgs) =>
console.log(booleanArgs)
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { validateAllArgsBoolean } from "puddy-m/lib/validators/complexValidators";
const run = async () => {
try {
const integerArgsBoolean = await validateAllArgsBoolean(
true,
false,
"true"
);
} catch (e) {
// Throws BooleanValidationError
console.log(e);
}
};
run();