function middleware(validateFn, paramFn) {
  async function validationMiddleware(koaCtx, next) {
    // Get the params from request body and validate
    //  Updates koaCtx.swatchCtx with validated params
    const requestParams = paramFn(koaCtx);
    validateFn(koaCtx, requestParams);

    await next();
  }

  return validationMiddleware;
}
//  the KOA context to the request params, return middleware
the KOA context to the request params, return middleware
the KOA context to the request params return middleware
function middleware(validateFn, paramFn) {
  async function validationMiddleware(koaCtx, next) {
    const requestParams = paramFn(koaCtx);
    validateFn(koaCtx, requestParams);
    await next();
  }
  return validationMiddleware;
}
function middleware ( validateFn , paramFn ) { async function validationMiddleware ( koaCtx , next ) { const requestParams = paramFn ( koaCtx ) ; validateFn ( koaCtx , requestParams ) ; await next ( ) ; } return validationMiddleware ; }
the KOA context to the request params, return middleware
the KOA context to the request params return middleware
// Get the params from request body and validate //  Updates koaCtx.swatchCtx with validated params