1 (function(angular
, $, _
) {
5 angular
.module('crmSearchActions', CRM
.angRequires('crmSearchActions'))
7 // Reformat an array of objects for compatibility with select2
8 // Todo this probably belongs in core
9 .factory('formatForSelect2', function() {
10 return function(input
, key
, label
, extra
) {
11 return _
.transform(input
, function(result
, item
) {
12 var formatted
= {id
: item
[key
], text
: item
[label
]};
14 _
.merge(formatted
, _
.pick(item
, extra
));
16 result
.push(formatted
);
21 })(angular
, CRM
.$, CRM
._
);