"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.composePlugins = void 0;
function composePlugins(...plugins) {
    return ((data, context) => {
        if (!plugins.length) {
            return context.handler(data, context.options);
        }
        if (plugins.length === 1) {
            return plugins[0]()(data, context);
        }
        return context.handler(plugins.reduce((acc, plugin) => {
            if (!acc) {
                return plugin();
            }
            return plugin(acc);
        }, null)(data, context), context.options);
    });
}
exports.composePlugins = composePlugins;
//# sourceMappingURL=composePlugins.js.map