"use strict";
var __values = (this && this.__values) || function(o) {
    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
    if (m) return m.call(o);
    if (o && typeof o.length === "number") return {
        next: function () {
            if (o && i >= o.length) o = void 0;
            return { value: o && o[i++], done: !o };
        }
    };
    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
function getParams(req, params) {
    var e_1, _a, e_2, _b;
    var _c, _d;
    var x = {};
    if ((req === null || req === void 0 ? void 0 : req.method) == "POST") {
        try {
            for (var params_1 = __values(params), params_1_1 = params_1.next(); !params_1_1.done; params_1_1 = params_1.next()) {
                var param = params_1_1.value;
                x[param] = (_c = req.body) === null || _c === void 0 ? void 0 : _c[param];
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (params_1_1 && !params_1_1.done && (_a = params_1.return)) _a.call(params_1);
            }
            finally { if (e_1) throw e_1.error; }
        }
    }
    else {
        try {
            for (var params_2 = __values(params), params_2_1 = params_2.next(); !params_2_1.done; params_2_1 = params_2.next()) {
                var param = params_2_1.value;
                x[param] = (_d = req.query) === null || _d === void 0 ? void 0 : _d[param];
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (params_2_1 && !params_2_1.done && (_b = params_2.return)) _b.call(params_2);
            }
            finally { if (e_2) throw e_2.error; }
        }
    }
    return x;
}
exports.default = getParams;
//# sourceMappingURL=get-params.js.map