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