function getRenderedTemplate(template, data, variableRegex) {
  return template.replace(variableRegex, (match, captured) => {
    const replacement = valueForProperty(data, captured.trim());
    // If a template variable is found but nothing is supplied to fill it, remove it
    if (replacement == null) {
      return '';
    }

    // If the replacement is a function, replace the variable with the result of the function
    if (typeof replacement === 'function') {
      return replacement();
    }

    // otherwise replace the template variable with the associated data
    return replacement;
  });
}
function getRenderedTemplate(template, data, variableRegex) {
  return template.replace(variableRegex, (match, captured) => {
    const replacement = valueForProperty(data, captured.trim());
    
    if (replacement == null) {
      return '';
    }

    
    if (typeof replacement === 'function') {
      return replacement();
    }

    
    return replacement;
  });
}
function getRenderedTemplate ( template , data , variableRegex ) { return template . replace ( variableRegex , ( match , captured ) => { const replacement = valueForProperty ( data , captured . trim ( ) ) ; // If a template variable is found but nothing is supplied to fill it, remove it if ( replacement == null ) { return '' ; } // If the replacement is a function, replace the variable with the result of the function if ( typeof replacement === 'function' ) { return replacement ( ) ; } // otherwise replace the template variable with the associated data return replacement ; } ) ; }
Gets the rendered output of a template
@param {String} template - A template to use as a base for the render
@param {Object} data - The data to use when populating the templates
@param {RegExp} variableRegex - The regex to use for indentifying template variables
Gets the rendered output of a template