index.js
function arity(min, max = Number.MAX_SAFE_INTEGER) {
  return (req, res, next) => {
    const foundArity = parsePath(req).length-1;
    if (foundArity < min ) {
      next(new ModofunError(400, 'InvalidInput',
        `This operation requires ${min} parameters. Received ${foundArity}.`));
    } else if (foundArity > max ) {
      next(new ModofunError(400, 'InvalidInput',
        `This operation doesn't accept more than ${max} parameters. Received ${foundArity}.`));
    } else {
      next();
    }
  }
}
function arity(min, max = Number.MAX_SAFE_INTEGER) {
  return (req, res, next) => {
    const foundArity = parsePath(req).length-1;
    if (foundArity < min ) {
      next(new ModofunError(400, 'InvalidInput',
        `This operation requires ${min} parameters. Received ${foundArity}.`));
    } else if (foundArity > max ) {
      next(new ModofunError(400, 'InvalidInput',
        `This operation doesn't accept more than ${max} parameters. Received ${foundArity}.`));
    } else {
      next();
    }
  }
}
function arity ( min , max = Number . MAX_SAFE_INTEGER ) { return ( req , res , next ) => { const foundArity = parsePath ( req ) . length - 1 ; if ( foundArity < min ) { next ( new ModofunError ( 400 , 'InvalidInput' , ` ${ min } ${ foundArity } ` ) ) ; } else if ( foundArity > max ) { next ( new ModofunError ( 400 , 'InvalidInput' , ` ${ max } ${ foundArity } ` ) ) ; } else { next ( ) ; } } }
Utility middleware to enforce a minimum number of parameters.
Accepts an extra argument for an optional maximum number.
@public
Utility middleware to enforce a minimum number of parameters . Accepts an extra argument for an optional maximum number .