validateAllArgs

It resolves if all args passed in the parameter list validates against the validateFunction passed in the first parameter. This function is to be used as a helper for the following functions:
  • validateAllArgsInteger
  • validateAllArgsNumber
  • validateAllArgsArray
  • validateAllArgsBoolean
  • validateAllArgsNull
  • validateAllArgsObject
  • validateAllArgsString.
  • If you would like to use this function, you need to create your own promise based validation function.
    Parameter ListReturnsRejection Errors
    • validateFunction: Function
    • ...args: *
    Promise<Array<*>>
    Related FunctionsFunction Signature
    function validateAllArgs(validateFunction, ...args): Promise<Array<*>>
    1 2 3 4 import { validateAllArgs } from "puddy-m/lib/validators/complexValidators"; import { validateBoolean } from "puddy-m/lib/validators"; validateAllArgs(validateBoolean, true, true, false, true).then(console.log); // [true, true, false, true]
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import { validateAllArgs } from "puddy-m/lib/validators/complexValidators"; import { validateString } from "puddy-m/lib/validators"; // It also works with await. const f = async () => { const validatedArgs = await validateAllArgs( validateString, "true", "", "78", "str" ); console.log(validatedArgs); // ["true", "", "78", "str"] }; f();