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