function processString(str, context) {
  if (dictionary[str] === undefined) {
    dictionary[str] = str.match(/{{\s*([^}]+)\s*}}/g) || [];
  }
  const matches = dictionary[str];
  return matches.reduce((p, c) => {
    const solution = evaluator.evaluate(c.substr(2, c.length - 4), context);
    return solution !== null && solution !== undefined
      ? p.replace(c, solution)
      : p;
  }, str);
}
Process a string using a dictionary to don't repeat the regex match.
@param {string} str String to be processed.
@param {object[]} context Context with the variables to be replaced.
@returns {string} String processed with context variables replaced.