setSelectionMethodsForModules = function (modules) {

		/**
		 * Filter modules with the specified classes.
		 * @param {string|string[]} className one or multiple classnames (array or space divided).
		 * @returns {Module[]} Filtered collection of modules.
		 */
		const withClass = function (className) {
			return modulesByClass(className, true);
		};

		/**
		 * Filter modules without the specified classes.
		 * @param {string|string[]} className one or multiple classnames (array or space divided).
		 * @returns {Module[]} Filtered collection of modules.
		 */
		const exceptWithClass = function (className) {
			return modulesByClass(className, false);
		};

		/**
		 * Filters a collection of modules based on classname(s).
		 * @param {string|string[]} className one or multiple classnames (array or space divided).
		 * @param {boolean} include if the filter should include or exclude the modules with the specific classes.
		 * @returns {Module[]} Filtered collection of modules.
		 */
		const modulesByClass = function (className, include) {
			let searchClasses = className;
			if (typeof className === "string") {
				searchClasses = className.split(" ");
			}

			const newModules = modules.filter(function (module) {
				const classes = module.data.classes.toLowerCase().split(" ");

				for (const searchClass of searchClasses) {
					if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
						return include;
					}
				}

				return !include;
			});

			setSelectionMethodsForModules(newModules);
			return newModules;
		};

		/**
		 * Removes a module instance from the collection.
		 * @param {object} module The module instance to remove from the collection.
		 * @returns {Module[]} Filtered collection of modules.
		 */
		const exceptModule = function (module) {
			const newModules = modules.filter(function (mod) {
				return mod.identifier !== module.identifier;
			});

			setSelectionMethodsForModules(newModules);
			return newModules;
		};

		/**
		 * Walks thru a collection of modules and executes the callback with the module as an argument.
		 * @param {Function} callback The function to execute with the module as an argument.
		 */
		const enumerate = function (callback) {
			modules.map(function (module) {
				callback(module);
			});
		};

		if (typeof modules.withClass === "undefined") {
			Object.defineProperty(modules, "withClass", { value: withClass, enumerable: false });
		}
		if (typeof modules.exceptWithClass === "undefined") {
			Object.defineProperty(modules, "exceptWithClass", { value: exceptWithClass, enumerable: false });
		}
		if (typeof modules.exceptModule === "undefined") {
			Object.defineProperty(modules, "exceptModule", { value: exceptModule, enumerable: false });
		}
		if (typeof modules.enumerate === "undefined") {
			Object.defineProperty(modules, "enumerate", { value: enumerate, enumerable: false });
		}
	}
Adds special selectors on a collection of modules.
@param {Module[]} modules Array of modules.