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