src/index.js
function render(form, template) {
  const compiledRowTemplate = handlebars.compile(
    '<tr class="form-element">' +
      '<td class="key">{{key}}</td>' +
      '<td class="value">{{value}}</td>' +
    '</tr>');
  const compiledTable = handlebars.compile(
    '<table><tbody>{{{rows}}}</tbody></table>');
  const compiledTemplate = handlebars.compile(template);

  const formElements = form.map(({key, value}) => {
    if (key !== 'File') {
      return compiledRowTemplate({key, value: unescape(value)});
    }

    return null;
  });

  const formData = compiledTable({rows: formElements.join(' ')});

  return compiledTemplate({formData});
}
function render(form, template) {
  const compiledRowTemplate = handlebars.compile(
    '<tr class="form-element">' +
      '<td class="key">{{key}}</td>' +
      '<td class="value">{{value}}</td>' +
    '</tr>');
  const compiledTable = handlebars.compile(
    '<table><tbody>{{{rows}}}</tbody></table>');
  const compiledTemplate = handlebars.compile(template);

  const formElements = form.map(({key, value}) => {
    if (key !== 'File') {
      return compiledRowTemplate({key, value: unescape(value)});
    }

    return null;
  });

  const formData = compiledTable({rows: formElements.join(' ')});

  return compiledTemplate({formData});
}
function render ( form , template ) { const compiledRowTemplate = handlebars . compile ( '<tr class="form-element">' + '<td class="key">{{key}}</td>' + '<td class="value">{{value}}</td>' + '</tr>' ) ; const compiledTable = handlebars . compile ( '<table><tbody>{{{rows}}}</tbody></table>' ) ; const compiledTemplate = handlebars . compile ( template ) ; const formElements = form . map ( ( { key , value } ) => { if ( key !== 'File' ) { return compiledRowTemplate ( { key , value : unescape ( value ) } ) ; } return null ; } ) ; const formData = compiledTable ( { rows : formElements . join ( ' ' ) } ) ; return compiledTemplate ( { formData } ) ; }
Function that returns the html to be rendered in the email
@param {array} form an array of key value pairs
@param {string} template The template to compile.
@return {string} The rendered template.
Function that returns the html to be rendered in the email