import getIncumbentIds from '../getIncumbentIds';

/**
 * Function to determine if a contest has at least one incumbent.
 *
 * @param {CandidateMetadata[]} candidates
 *   An array of candidate metadata
 * @returns {boolean}
 */
const candidatesIncludeIncumbent = function candidatesIncludeIncumbent(candidates) {
  const incumbents = getIncumbentIds(candidates);
  return incumbents.length > 0;
};
export default candidatesIncludeIncumbent;