'use strict';

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

exports.default = function (pluginContext) {
  return function (cspaceDocument) {
    var getPart = pluginContext.recordDataHelpers.getPart;
    var getDisplayName = pluginContext.refNameHelpers.getDisplayName;


    if (!cspaceDocument) {
      return '';
    }

    var common = getPart(cspaceDocument, 'loansout_common');

    if (!common) {
      return '';
    }

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

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