Skip to content

Instantly share code, notes, and snippets.

@jmahc
Created January 23, 2020 07:43
Show Gist options
  • Save jmahc/254320346f749f064c111c3770035cb7 to your computer and use it in GitHub Desktop.
Save jmahc/254320346f749f064c111c3770035cb7 to your computer and use it in GitHub Desktop.
Express Validator function collector
/**
* Validate with the provided `express-validator` function options.
*
* @export {Function} A function that will utilzie `express-validator` methods to validate parameters.
* @param {Functions} fns The `express-validator` methods to validate parameters.
* @returns {Array} An array of functions with the `express-validator` middleware provided.
*/
export function validateWith(...fns) {
return [...fns, validatorMiddleware]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment