function assertInteger(attr, data) {
  if (!Number.isInteger(data)) {
    throw new BadRequestError(`Attribute ${attr} must be an integer`);
  }

  return data;
}
Throws if the provided data is not an integer
Returns the unmodified data if validated

@throws
@param {string} attr - tested attribute name
@param {*} data
@return {number}