'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, 'loansout_common');

  if (!common) {
    return '';
  }

  const loanOutNumber = common.get('loanOutNumber');
  const borrower = getDisplayName(common.get('borrower'));

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