"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.arrayify = exports.validate = void 0;
function validate(value, raw, argument) {
    if (!argument.match)
        return;
    const result = (typeof argument.match === 'function')
        ? argument.match(value, raw, argument)
        : argument.match.test(raw);
    if (!result)
        throw new Error(`Invalid argument for ${argument.name}: ${value}`);
}
exports.validate = validate;
function arrayify(value) {
    if (value == null)
        return [];
    else if (Array.isArray(value))
        return [...value];
    else
        return [value];
}
exports.arrayify = arrayify;
