validateAllArgsInteger
Description
It resolves the list of args if they are integers. If there is at least one item from the list that is not an Integer (number type with no decimal points), this function will throw.
If the intention is to validate numbers in general, you should utilise the validateAllArgsNumber instead.
Parameter List | Returns | Rejection Errors |
---|---|---|
| Promise<Array<Number>> | |
Related Functions | Function Signature | |
function validateAllArgsInteger(...everything): Promise<Array<Number>> |
Examples
1
2
3
import { validateAllArgsInteger } from "puddy-m/lib/validators/complexValidators";
validateAllArgsInteger(1, 2, 3).then((integerArgs) => console.log(integerArgs));
1
2
3
4
5
6
7
8
9
10
11
12
import { validateAllArgsInteger } from "puddy-m/lib/validators/complexValidators";
const run = async () => {
try {
const integerArgs = await validateAllArgsInteger(1, 2, "3");
} catch (e) {
// Throws NumberValidationError
console.log(e);
}
};
run();