'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = pluginContext => data => {
  const getPart = pluginContext.recordDataHelpers.getPart;
  const getDisplayName = pluginContext.refNameHelpers.getDisplayName;


  if (!data) {
    return '';
  }

  const common = getPart(data, 'pottags_common');

  if (!common) {
    return '';
  }

  const commonName = common.get('commonName');
  const family = getDisplayName(common.get('family'));

  return [commonName, family].filter(part => !!part).join(' – ');
};