/**
 * Get a candidate's name in a particular format from their metadata.
 *
 * @param {CandidateMetadata} candidate
 *   The metadata of the candidate whose name you want. If no metadata is
 *   provided or if the metadata doesn't contain the appropriate name
 *   information for the requested format, this function returns `undefined`.
 * @param {Object} [options]
 *   Additional configuration options:
 *   - `format`: The format of the name (either `short` or `full`, with `full`
 *     being the default)
 * @returns {string}
 */
const getCandidateName = function getCandidateName(candidate = {}, options = {}) {
  const {
    format = 'full'
  } = options;
  const {
    shortName,
    fullName
  } = candidate;
  const names = {
    short: shortName,
    full: fullName
  };
  return names[format];
};
export default getCandidateName;