code: function getUserData(data, checks) {
    if (Array.isArray(data) ? data.length === 0 : data.total === 0) {
      throw new errors.BadRequest('User not found.', { errors: { $className: 'badParams' } });
    }
    
    const users = Array.isArray(data) ? data : data.data;
    const user = users[0];
    
    if (users.length !== 1) {
      throw new errors.BadRequest('More than 1 user selected.',
        { errors: { $className: 'badParams' } });
    }
  
    if (checks.indexOf('isNotVerified') !== -1 && user.isVerified) {
      throw new errors.BadRequest('User is already verified.',
        { errors: { $className: 'isNotVerified' } });
    }
  
    if (checks.indexOf('isVerified') !== -1 && !user.isVerified) {
      throw new errors.BadRequest('User is not verified.',
        { errors: { $className: 'isVerified' } });
    }
    
    if (checks.indexOf('verifyNotExpired') !== -1 && user.verifyExpires < Date.now()) {
      throw new errors.BadRequest('Verification token has expired.',
        { errors: { $className: 'verifyExpired' } });
    }
  
    if (checks.indexOf('resetNotExpired') !== -1 && user.resetExpires < Date.now()) {
      throw new errors.BadRequest('Password reset token has expired.',
        { errors: { $className: 'resetExpired' } });
    }
  
    return user;
  }
docs: made safe for testing