'use strict';

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

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


    if (!data) {
      return '';
    }

    var common = getPart(data, 'groups_common');

    if (!common) {
      return '';
    }

    var title = common.get('title');
    var owner = getDisplayName(common.get('owner'));

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