/*global Handlebars */
define(function() {
'use strict';
Handlebars.registerHelper('formatRecipients', function (header) {
function wrapWith(begin, end) {
return function (x) { return begin + x + end; };
}
var to = _.map(header.to, wrapWith('', ''));
var cc = _.map(header.cc, wrapWith('cc: ', ''));
var bcc = _.map(header.bcc, wrapWith('bcc: ', ''));
return new Handlebars.SafeString(to.concat(cc, bcc).join(', '));
});
});