"use strict";

module.exports = function combineOptimizers(optimizers) {
	let allVisitors = {};

	for (let optimizer of optimizers) {
		for (let [ key, visitor ] of Object.entries(optimizer.visitors)) {
			if (allVisitors[key] == null) {
				allVisitors[key] = [];
			}

			allVisitors[key].push({
				name: optimizer.name,
				func: visitor
			});
		}
	}

	return allVisitors;
};
