'use strict';

module.exports = function (template, args) {
  if (!args) {
    return interpolate.bind(null, template);
  }

  return interpolate(template, args);
};

function interpolate(template, args) {
  return template.replace(/{([^}]*)}/g, function (match, key) {
    return key in args ? args[key] : match;
  });
}
'use strict';

module.exports = function (template, args) {
  if (!args) {
    return interpolate.bind(null, template);
  }

  return interpolate(template, args);
};

function interpolate(template, args) {
  if (typeof args === 'undefined') {
    args = {};
  }
  return template.replace(/{([^}]*)}/g, function (match, key) {
    return key in args ? args[key] : match;
  });
}

Set the args variable value as an empty object if the argument in missing
Set the args variable value as an empty object if the argument in missing
