"use strict";

const { validateArguments } = require("@validatem/core");
const required = require("@validatem/required");
const isFunction = require("@validatem/is-function");

const node = require("../ast-node");

module.exports = function (_operations) {
	return function postProcess(_handler) {
		let [ handler ] = validateArguments(arguments, {
			handler: [ required, isFunction ]
		});

		// FIXME: Allow specifying before/after options? That tell it to place itself before or after a particular other postprocessing operation. With a special $begin and $end for the edges
		return node({ type: "postProcess", handler });
	};
};
