/**
 * @license Copyright (c) 2017-2025, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md.
 */

'use strict';

/**
 * The function returns a `page` object that represents the main landing page for given category.
 *
 * @param {String} category
 * @param {String} projectName
 * @param {Object} allPages
 * @param {Array} allPages.data
 * @returns {*}
 */
module.exports = function findMainCategoryPage( category, projectName, allPages ) {
	return allPages.data
		.filter( page => page.category === category && page.projectName === projectName )
		.find( page => page.shortName === 'index' );
};
