"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateIsDefined = validateIsDefined;
exports.validateIsNotNegativeInteger = validateIsNotNegativeInteger;
const ValidationError_1 = require("./ValidationError");
function validateIsDefined(varName, varValue) {
    if (varValue === undefined) {
        throw new ValidationError_1.ValidationError(`Expected ${varName} to not be undefined.`);
    }
}
function validateIsNotNegativeInteger(varName, varValue, allowUndefined = false) {
    if (allowUndefined && varValue === undefined) {
        return;
    }
    validateIsDefined(varName, varValue);
    if (!Number.isInteger(varValue)) {
        throw new ValidationError_1.ValidationError(`Expected ${varName} to be an integer but was a ${typeof varValue} (${varValue}).`);
    }
    if (varValue < 0) {
        throw new ValidationError_1.ValidationError(`Expected ${varName} to not be negative (${varValue}).`);
    }
}
//# sourceMappingURL=validations.js.map